I canโt imagine that the problem is .change()
, maybe somewhere else in your code, I just tested and the event will fire if I copy and paste, or if I type new text (with both normal and with on-screen keyboard).
The only time it didnโt work was when I dragged a piece of text from the desktop to the input window, but this was due to the fact that it was highlighted and quite sure when the input field lost focus, the event triggered (I canโt think any other use cases)
You can do something like below using the blur()
or focusout()
event, which in essence I consider change event
function foo(e) { alert(e.type + ' triggered'); } $('input').blur(function(e) { $t = $(this); if ($t.data('oVal') != $t.val()) { $t.data('oVal', $t.val()); foo(e); } })
source share