如何为工具提示 (Bootstrap) 显示不同的标题并 html 验证表单?

How to display different titles for the Tooltip (Bootstrap) and to html validate the form?

我尝试显示两个不同的工具提示标题 (Bootstrap) 和一个标准 html 验证表单。

示例代码 http://jsfiddle.net/00kvznLu/

<form data-toggle="validator" role="form" class='containter'>    
  <div class="form-group">
    <label for="inputTwitter" class="control-label">Twitter</label>
    <div class="input-group">
      <span class="input-group-addon">@</span>
      <input type="text" data-toggle="tooltip" title="Do it here..." pattern="^([_A-z0-9]){3,}$" maxlength="20" class="form-control" id="inputTwitter" placeholder="1000hz" required>
    </div>
  </div>
  <div class="form-group">
    <input type="submit" value="Check Form">
  </div>
</form> 

但由于某些原因,我的工具提示显示不如 http://getbootstrap.com/javascript/#tooltips

是否有可能使当您移动计算机鼠标时显示 title = "messages1",并将错误 [​​=44=] 推导到标准消息 "Enter the data in the specified format." 添加 title = "messages2"?

是否可以这样做tooltip-title="messages1"error-pattern-title="messages2"

Bootstrap 工具提示:

错误信息:

更新 1: 添加了 data-title="Custom Title"

<input type="text" data-toggle="tooltip" pattern="^([_A-z0-9]){3,}$" maxlength="20" class="form-control" data-title="Custom Title" title="Do it here.." id="inputTwitter" placeholder="1000hz" required>

你可以这样设置:

var newValue = 'This is a new message';
$(tooltip-selector).attr('title', newValue)
    .tooltip('fixTitle')
    .tooltip('show');

我建议您使用 data-original-title 而不是 title Fiddle here

检查@Mehmet Duran answer

使用下面的脚本。技巧是将工具提示应用于输入的父标签。让我知道这是否有帮助。 Working Fiddle

$(function () {
  $('#inputTwitter').parent().tooltip({
   title : $('#inputTwitter').data('title')
  });
})