Pre-recorded question

Question #18
jQuery: how to detect changes in HTML input field?
Answer

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 Alphonsio 05/03/2020 at 07:49:49 AM
jQuery: how to detect changes in HTML input field?
Answer by Alphonsio 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.