吴伟贤のBlog

Feed Rss

单击触发jquery.autocomplete的两种方法

05.20.2011, js, by .

jquery.autocomplete的参数 minChars设置为0时,默认要双击才会触发jquery.autocomplete,如果想要单击触发的话,得进行一定的处理才行.下面讲下我知道的单击触发jquery.autocomplete的两种方法

方法一:

绑定onclick事件=click():

<input name="test" onclick="$(this).click();" type="text" />

ie和谷歌下测试通过

方法二:

通用方法,修改源代码,把

}).click(function() {

// show select when clicking in a focused field

if ( hasFocus++ > 1 && !select.visible() ) {

onChange(0, true);

}

改成

}).click(function() {

// show select when clicking in a focused field

if ( ++hasFocus > 1 && !select.visible() ) {

onChange(0, true);

}

评论已关闭。