Find jobs - Flash Games - Find jobs - Bollywood News - Debt Consolidation

PDA

View Full Version : How to trigger a function when i press enter in a text box


sahilcoolsmart
Aug 16th 2007, 9:56 pm
I am doing some AJAX project. And in that i have a form which gets submitted through AJAX. But what i want is when users press enter the submitting function should be called.
Users have to press submit button as of now, and i don't want that.

bibel
Aug 16th 2007, 11:55 pm
When you press enter in a text box, the form is submited.
You just need to add onsubmit="return yourAjaxFunction()" to the form element.
Just make sure yourAjaxFunction returns false.