jQuery 1.3.2. autocomplete – keydown bug
Not using jQuery version 1.3.2? Skip this post.
Working with the jquery autocomplete-complete plugin today made me notice the control performs some weird behavior when you try to unbind or unautocomplete.
In a nutshell: renewing the autocomplete plugin will not unbind the “keydown” event. This is actually due to a bug in jQuery 1.3.2.
What can we do about it?
- Change your version of the jQuery plugin (1.4 fixed the “keydown” bug)
- Or manually update the autocomplete plugin to support jQuery 1.3.2
Where can you update the autocomplete to support 1.3.2? Open your file and look for the following code:
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind();
$(input.form).unbind(".autocomplete");
});
Just add one line of code before the $input.unbind() method:
}).bind("unautocomplete", function() {
select.unbind();
$input.unbind("keydown.autocomplete");
$input.unbind();
$(input.form).unbind(".autocomplete");
});
Presto!
(ps: Working in Visual Studio? make sure you modify the jquery.autocomplete.min.js file, this file is used when your application runs on the webserver.)
Categories: Programming, Uncategorized, Webdevelopment
Thank you so much for this fix I searched to solve for a while
i also catch this problem , i follow this method ,,but it does not work
it’s my fault,you are right .thank you
Thank you very much – I was running out of options until I found this post. That fix worked perfectly.