Skip to content Skip to sidebar Skip to footer

Jquery Autocomplete: Hitting Return Submits The Form

I am using the jQuery Autocomplete plugin. // I'm not sure if there's a better way to do this var base_url = window.location.href.slice(0, window.location.href.indexOf('/bar')); $

Solution 1:

I would recommend adding an keypress event on the Autocomplete element and return false from that. It will not impact your ability to submit the rest of the form at a later time.

Solution 2:

You will want to disable submission on enter by hooking up an event handler for form.submit: $("form").submit(function() { return false; });

Post a Comment for "Jquery Autocomplete: Hitting Return Submits The Form"