When I trigger a paste event with .trigger(), the ensuing captured paste event has no .originalEvent property. Is this expected behavior? Why?
See example - http://jsfiddle.net/2uxEr/
<textarea>Paste something here</textarea>
<button>Click for fake trigger</button>
$('textarea').on("paste", function(e){
alert(e.hasOwnProperty("originalEvent"));
});
$('button').click(function(){
$('textarea').trigger("paste");
});
jQuery events will not have an originalEvent
property if they were triggered manually. How could they? The originalEvent
is the event object created by the browser from which jQuery formed its event object; in a manually triggered event, jQuery created the event object itself. There is no originalEvent
to access.
This jsFiddle example shows how this is true for events like click
as well as paste
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With