The Jquery autocomplete (LINK) has an option to turn it off, which looks like this:
$(input).autocomplete({ disabled: true });
I would like it to be turned off because its default settings is to respond on keyup. I much rather have it function on keydown. So I turned it off and I wrote a function with an event keydown like this:
timer = 0;
function func (){
var val = $(input).val();
$(input).autocomplete('search', val);
}
$(input).live('keydown', function(){
if (timer) {
clearTimeout(timer);
}
timer = setTimeout(func, 50000);
$(input).autocomplete( "enable" );
});
It doesn't work...meaning it does not do search after 50000 ms but instead it does the default setting with keyup. What should I change?
keydown?