-
-
Save brandonaaskov/1596867 to your computer and use it in GitHub Desktop.
/* | |
For some reason, the change() event only fires when the input field loses focus. | |
Binding to other options ('change keypress paste focus textInput input') will | |
fire the event several times, which is bad. The below code works even when | |
content is pasted into the text field, and only fires once as expected. | |
*/ | |
$('#search-form .term').bind('input', function(){ | |
console.log('this actually works'); | |
}); | |
/* | |
HTML example: | |
<form id="search-form"> | |
<input type="text" class="term" name="Search" value="Search" autocomplete="off" /> | |
<input type="submit" name="Search" value="Search" /> | |
</form> | |
*/ |
so helpful!
Saved me a lot of time. Thx!
I was struggled with onchange event and this is great help.
Thank you very much. This works perfectly with Google Chrome for mobile.
Simply perfect!
Perfect! Thanks for the insight!
Cheers! Works as expected.
Excellent, works perfectly, thank you!
Thank you for the save!
Thanks!
Tried all versions I found in this thread, but for +/- buttons, but ...
$('.theclass').change('input', function(){
console.log('this actually fails');
});
... only works when changing the value by typing. But changing by clicking +/- buttons does nothing. Maybe a conflict with another function that is called when the value changes?
I'm trying it to use with a DB of users, but it take so long to respond and show the result. Any idea please!!!!
@jpausa First, test your request with your database and see the time used by that request to execute. Then try to simplify as mush as possible your request, select only the field that are required. I am getting good response time with my code.
thanks for this!
Thank you.
Thank you.
Thanks!
It is work as expected, Thanks!!!
Thanks :)
Thank you
thanks this work really !!
it works as...
$('#xyz').bind('input', function () {
alert('Changed!');
});
// -- where "xyz" is the text box id
Better to use
.on('input')
asbind
is a core javascript function https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_objects/Function/bind