its*_*sme 4 javascript jquery input tooltip twitter-bootstrap
我想显示工具提示,input.val().length <= 3然后在> 3个字符时隐藏工具提示
看一下这个:
<input type="text" id="nav-search"/>
$('#nav-search').on('keyup',function(){
var _keys = $(this).val();
if(_keys.length <= 3){
$(this).tooltip({'trigger':'focus',position:'right'});
$(this).trigger('focusin');
}
});
Run Code Online (Sandbox Code Playgroud)
它显然不起作用:/
从理论上讲,它应该工作:
$("#nav-search").on("keyup", function() {
if (this.value.length <= 3) {
$(this).tooltip("show");
} else {
$(this).tooltip("hide");
}
}).tooltip({
placement: "right",
trigger: "focus"
});?
Run Code Online (Sandbox Code Playgroud)
实际上,它有效.
演示: http ://jsfiddle.net/FvxnN/
| 归档时间: |
|
| 查看次数: |
5758 次 |
| 最近记录: |