Join Onbux For Free and Earn Money

Submit a Form Using Enter Key



I have a form like this






I want to submit this form after entering password field by pressing enter key. How can I do that?


Answer:



It's a very simple thing. You just need to call a javascript on 'onkeypress' event of the text box.



<td><input name="password" type="password" onkeypress="enableKey()" /></td>


If you're doing any client side validation on this page, you need to call that function inside enableKey().


My enableKey function looks like this.

function enableKey(){

if(window.event.keycode==13){

loginValidation();

}
}