Plugins

User login
Can't find a Plugin?

Can't find a Plugin you are looking for? Check out the jQuery Wiki page.

Are you a plugin developer? Please move your plugin over to this site.

Website Bug or Feature Request?

Found a bug on the new jQuery Plugin website? Have a feature request?

Submit it to the jQuery Plugin website issue queue to ensure it is noticed!

minchars bug


Project:jquery.suggest, a "Google Suggest"-like autocompleter
Version:1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

if the minchars option is set to 1 the suggest will not display until 2 characters have been entered. After that, results will display on 1 character. I believe I have a work around, but it needs further testing. Attached is a patched version.

I removed the event handlers in .suggest function from

// I really hate browser detection, but I don't see any other way
if ($.browser.mozilla)
  $input.keypress(processKey); // onkeypress repeats arrow keys in Mozilla/Opera
else
  $input.keydown(processKey); // onkeydown repeats arrow keys in IE/Safari

To:
$input.keyup(processKey);

...and that seemed to solve the problem. I *think* it works because keydown is registered before the form value is part of the DOM, where keyup is after the data has been entered. Enclosed is the patched version.

AttachmentSize
jquery.suggest.js__0.txt6.56 KB