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

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

方法一:

绑定onclick事件=click():

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

ie和谷歌下测试通过http://www.hainangy.com


方法二:

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

}).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);

}

 

http://hi.baidu.com/aspxjsp/item/86eb895c4b5a8a3c94eb056c

posted @ 2012-08-31 11:16  y0umer  阅读(544)  评论(0编辑  收藏  举报