工具提示无法处理textarea bootstrap

时间:2014-12-31 09:25:32

标签: javascript jquery html twitter-bootstrap

我有一个bootstrap 3表单,我通过脚本应用tootip。 toottip在输入框上工作正常,但不能在textarea上工作。

<div class="control-group">
              <label class="control-label" for="firstname">Message Subject : </label>
            <div class="controls">
              <input type="text" class="form-control"
              placeholder="Subject" id="name" name="Subject" maxlength="70" minlength="10" required
              data-validation-required-message="Please enter subject" aria-describedby="sizing-addon3" data-toggle="tooltip" title="Input Message Subject between 10 to 80" />
              <p class="help-block"></p>
            </div>
          </div>


          <div class="control-group">
            <div class="controls">
                <label class="control-label" for="content" >Message Content : </label>
              <textarea rows="10" cols="100" class="form-control"
              placeholder="Message" id="message" name="Content" required
              data-validation-required-message="Please enter your message" minlength="5"
              data-validation-minlength-message="Min 5 characters"
              maxlength="999" style="resize:none" data-toggle="tooltip" title="Input Message Subject between 50 to 500"></textarea>
            </div>
          </div>

并且脚本就像这样

 $('a').tooltip({placement: "top"});

    $('input[type=text][name=Subject]').tooltip({
    placement: "right",
    trigger: "focus"
});

$('input[type=textarea][name=Content]').tooltip({
    placement: "right",
    trigger: "focus"
});

它在输入文本上运行良好,但在textarea上运行良好..

1 个答案:

答案 0 :(得分:3)

您的选择器错误更改为:

$('textarea[name=Content]')

JsFiddle