I have a search form and I want to submit the form just after user has entered any word in input field. I don't want any submit button or enter key. How can I do this ?
Asked
Active
Viewed 2,366 times
1
-
you are looking for the onchange event and the form.submit() method. – sics Sep 28 '12 at 06:06
-
1I don't think the `onchange` event fires until the user presses Enter or leaves the field. – Barmar Sep 28 '12 at 06:07
-
Possible duplicate http://stackoverflow.com/questions/12447045/how-to-auto-submit-form-after-entering-text-of-certain-length-into-input-field – iLaYa ツ Sep 28 '12 at 06:08
-
http://stackoverflow.com/questions/667555/detecting-idle-time-in-javascript-elegantly .. why don't you submit the call when the user is idle for some time – Apurv Sep 28 '12 at 06:27
-
try `.onkeydown()` or `.onkeypress()` events in jQuery. – Ajay Gupta Jan 11 '16 at 10:49
4 Answers
0
You can try this..
$('#text-field-id').keyup(function()
{
$('#form-id').submit();
});

Ashwini Agarwal
- 4,828
- 2
- 42
- 59
0
use javascript
for this like this
<script>
function submit()
{
form.submit();
} </script>
<input type="text" onkeyup="submit();">

Yogesh Suthar
- 30,424
- 18
- 72
- 100
0
<input type="text" name="searchbox" onkeypress="document.getElementById('myform').submit()" />

karaxuna
- 26,752
- 13
- 82
- 117
0
<input type="text" onkeyup="autocomplete">
function autocomplete()
{
formid.submit();
}
Also, You may try out some ajax.

AkiShankar
- 332
- 5
- 16