Question #18   Submitted by Answiki on 05/03/2020 at 07:49:49 AM UTC

jQuery: how to detect changes in HTML input field?

Answer   Submitted by Answiki on 05/03/2020 at 07:49:40 AM UTC

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.



2 events in history
Question by Answiki 05/03/2020 at 07:49:49 AM
jQuery: how to detect changes in HTML input field?
Answer by Answiki on 05/03/2020 at 07:49:40 AM

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.



# ID Query URL Count

Icons proudly provided by Friconix.