Skip to content Skip to sidebar Skip to footer

How To Submit A Form Onkeypress With Javascript?

I want to make a form like this, and i want to post the form - with javascript - in all the keydowns.

Solution 1:

<formonkeydown="this.submit();"><!-- form content --></form>

Solution 2:

<body onkeydown="document.forms["myform"].submit();">

Solution 3:

If you do that, the page will reload, just as if you were clicking the submit button. What you probably want is to attach an onkeydown handler to the password field and submit key presses via AJAX.

For an example look at one of javascript auto-suggest libraries, e.g. AJAX Auto Suggest.

Post a Comment for "How To Submit A Form Onkeypress With Javascript?"