开发者

modify autocomplete.js

i am trying to add a button in the autocomple.js when no match if found and it should allow开发者_如何学编程 the user to turn off autocomplete. i have added the button but i can not fire a event on the button click.. this is the code where i am trying to bind the mousedown event with the button

if (li.childNodes[x].tagName && li.childNodes[x].tagName == 'INPUT')
{
    (li.childNodes[x]).mousedown(function() {
        alert('finally');
    });
}

thanks in advance .. cheers.... abhi


This code in place of your snippet will do the trick:

if (li.childNodes[x].tagName && li.childNodes[x].tagName == 'INPUT') {
    $(li.childNodes[x]).click(function() {
        alert('finally');
    });
}

Note that I added the $ on line 2 and bound to the click event instead of mousedown.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜