开发者

modify autocomplete.js

开发者 https://www.devze.com 2022-12-08 04:07 出处:网络
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 th

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

精彩评论

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