👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
JavaScript: how to detect changes in HTML input field?
The best way to detect changes in HTML input field in jQuery if to bind the input
event of the input field:
$('#myInputField').on('input', function() {
// The input has changed, do something
});
You may also extend the event list:
$('#myInputField').on('input propertychange paste', function() {
// The input has changed, do something
});
You may also detect the change
event, but it will only fire after the input field lost focus.