[jQuery] click() behaves weird
I have multiple search forms in my application each of them have the
same structure with input text fields and a search button. The submit
button has an onclick event attached which submits form values with
AJAX.
For submit-on-ENTER support i added a keylistener to each input text
field and bound it to the search button click method for submitting
the form.
--
jQuery(".search input:text").keypress(function(e) {
if (e.which == 13 || e.keyCode == 13) { // ENTER-Key
jQuery(".btnSearch").click();
}
});
--
The weird thing is that the form is submitted from some pages and is
not from the rest. Instead these forms are submitted via the form
action instead of calling the onclick AJAX event on the submit button.
Any ideas what is going on here?