I’m doing an Ajax request on keyup or paste. The problem is that when users use Control-V to paste, two ajax requests occur- one for paste, one for keyup.
$("#my-form").bind('keyup paste', function(e) {...}
What’s a good way to bind on either keyup OR paste?
You can use
setTimeout/clearTimeoutto delay the event, so it only triggers once.DEMO: http://jsfiddle.net/4b7y5/