What is the difference between on change and on input event in jQuery

Forums jQueryWhat is the difference between on change and on input event in jQuery
Staff asked 2 years ago

What is the difference between on change and on input event in jQuery?

on change Event

$( '.test' ).on( 'change', function() {

} );

on input Event

$( '.test' ).on( 'input', function() {

} );

 

Answers (1)

Add Answer
Staff answered 2 years ago

The difference is that the oninput event occurs immediately after the value of an element has changed, while onchange occurs when the element loses focus, after the content has been changed

Subscribe

Select Categories