tags:

views:

30

answers:

1

hi all, 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

+1  A: 

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.

Marve
thanks a ton sirji.... :-) its working fine now
abhishek singh