Shelane Enos schrieb: > The reason being that when I have an autocomplete field the user will start > type something in the field and can arrow down and hit enter when on the > selected item. However, if they have "outtyped" the field and there is no > option select (none returned in the autocomplete) they are hitting enter by > habit from that field and inadvertently submitting the form. > > So really, I only need it disabled so long as they're in the autocomplete > field.
I've done something like this for Plazes, here's the relevant part of the script: autocompleter .attr('autocomplete', 'off') // Prevent clash with Firefox' autocomplete feature causing an exception. .keypress(function(e) { if ($(o.AUTOCOMPLETE_OUTPUT).is(':visible')) { if (e.keyCode == 13) { $(o.AUTOCOMPLETE_OUTPUT + ' a.selected').click(); return false; } } }) You need to use keypress for browser consistency. What it does is triggering a click on the link with the class selected. you may need to adapt that to your needs. Basically I modified Dylan's autocomplete plugin a bit. autocompleter is an jQuery object with an input. So replace that with $('#your-autocomplete-input') -- Klaus _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/