Reputation: 990
The<input type="text">
submit the entry after a click outside of it.
How can I submit the input automatically?
<input type="text" name="sQuantity" id="sQuantity" value="1" onchange="onChangeInput()" onblur="onBlurInput()">
My try:
$( "#sQuantity" ).change(function() {
$( "body" ).click();
});
Upvotes: 1
Views: 41
Reputation: 2617
Use keyup or keydown
$( "#sQuantity" ).keyup(function() {
$( "body" ).click();
});
You can also use onKeyup instead of onChange on the input as well.
<input type="text" name="sQuantity" id="sQuantity" value="1" onKeyup="onChangeInput()">
And here is some info on keyup and how it works https://api.jquery.com/keyup/
Upvotes: 2
Reputation: 980
you can use keyup event like this :
<input id="sQuantity" onchange="onChangeInput();" value="1" type="text"
onkeyup="this.onchange();" onpaste="this.onchange();" oninput="this.onchange(); onblur="onBlurInput()""/>
Upvotes: 0