Reputation: 681
How to detect changing of a text field when user inserts a text from the clipboard using mouse (trackpad)? 'change', 'keyup', 'click' events are not fired in this case. How it is done on Twiiter?
Upvotes: 3
Views: 385
Reputation: 237817
If no traditional events work, you may have to set up some kind of polling system:
$('input').focus(function(){
setInterval(function(){
if (this.value != $.data(this, 'oldVal')) {
$(this).trigger('change');
}
}, 250);
}).change(function(){
$.data(this, 'oldVal', this.value);
// do your onchange code here
});
Upvotes: 3