html <input type="text" /> onchange event not working
Solution 1:
onchange
is only triggered when the control is blurred. Try onkeypress
instead.
Solution 2:
Use .on('input'...
to monitor every change to an input (paste, keyup, etc) from jQuery 1.7 and above.
For static and dynamic inputs:
$(document).on('input', '.my-class', function(){
alert('Input changed');
});
For static inputs only:
$('.my-class').on('input', function(){
alert('Input changed');
});
JSFiddle with static/dynamic example: https://jsfiddle.net/op0zqrgy/7/