Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
92
rated 0 times [  94] [ 2]  / answers: 1 / hits: 20731  / 11 Years ago, wed, february 20, 2013, 12:00:00

I need to check for all events which will change the contents of my text input. so far I have handlers for keyup, cut and paste. but the content can also be changed by highlighting the text and clicking delete or undo. is there a way to listen for these events?



$('#input').on('paste cut  keyup ',function() {
//add delete and undo to listner
});

More From » jquery

 Answers
16

You have more problems than this, you also have to worry about browsers with autofill features, etc. For this reason HTML5 has included the input event, which is included in modern browsers.



See this answer for a method of capturing every conceivable change event(*) the browser will let you capture, without firing more than once per change.



(*) Looks like they forgot cut, so add that in too.


[#80096] Tuesday, February 19, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jaydon

Total Points: 651
Total Questions: 103
Total Answers: 100

Location: Norway
Member since Mon, May 23, 2022
2 Years ago
;