当我选择:在自动填充被调用时,我试图防止发生模糊. (选择:当项目点击自动填充的建议框时调用)
但是,当我从建议框中选择一个项目时,无意中会调用模糊.
我该如何解决这个问题?
但是,当我从建议框中选择一个项目时,无意中会调用模糊.
我该如何解决这个问题?
以下是我的代码基本上排列的方式.
$("#input_field").autocomplete({
source: "source.PHP",select: function( event,ui ) { alert("Item selected! Let's not trigger blur!"); }
}).blur(function(event) {
alert("Alert if the user clicked outside the input,pressed enter,or tab button.");
alert("But not from the item selection! :S");
});
谢谢!
编辑:这是一个简短的上下文.如果用户模糊输入,我试图允许用户搜索/选择一个项目或创建一个新的项目.
解决方法
自动完成jquery UI小部件带有一个“更改”事件,我认为你想要的.它被称为模糊,除了当使用鼠标选择项目时不调用它.
$("#input_field").autocomplete({
source: "source.PHP",ui ) { alert("Item selected! Let's not trigger blur!"); }
});
$("#input_field").bind('autocompletechange',function(event,ui) {
alert("Alert if the user clicked outside the input,or tab button.");
alert("But not from the item selection! :S");
});