|
查看: 1052|回复: 2
|
关于JQuery - Autocomplete
[复制链接]
|
|
|
我有一个textbox ( id = txtP ),
下列的script是启动autocomplete的。
$("#txtP").autocomplete(search.php, {
minChars: 2,
matchContains: true,
max: 20
});
我还有一些的span ( class = pTxt ),
如下:
<span class="pTxt">aa</span>,
<span class="pTxt">bb</span>,
<span class="pTxt">cc</span>,
<span class="pTxt">dd</span> ...
当onclick event启动时,span 的innerHTML会置入于txtP里。如下:
$(".pTxt").click(function() {
$("#txtP").val($(this).html()? $(this).html():'');
});
以现在的情况来说,span的innerHTML会置入于txtP里,
如果我要启动autocomplete,
我必须要在txtP里按keydown、keyup、等才能启动。
请问我要如何能自动地启动autocomplete,
当我click on span 的时候?
[ 本帖最后由 x^^x 于 25-3-2009 04:26 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|
发表于 4-4-2009 07:57 PM
|
显示全部楼层
.bind("#txtP", function() {
onChange(0, true);
试看把它加在autocomplete.js的198行
如果不行的话试看把#txtp换成input
[ 本帖最后由 y小叶y 于 4-4-2009 08:02 PM 编辑 ] |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 6-4-2009 04:56 PM
|
显示全部楼层
.bind("#txtP", function() {
onChange(0, true);
});
试过了,没作用。
我其实要它的自动搜寻和打开result list。
看过Jquery autocomplete 的Options,
做不到。
谢谢你的回复。 |
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|