javascript - Are jQuery events blocking -
are jquery events blocking?
for example calling following method return immediately?
$("body").trigger("myeventname", myvalue);
my testing seems suggest are. if correct mean can return values custom events?
var myresult = $("body").trigger("myeventname", myvalue);
clearly doesnt work returns jquery object. can values returned?
you can use .triggerhandler()
method this, returns whatever last event handler event on selector returns (instead of jquery object chaining), use this:
var myresult = $("body").triggerhandler("myeventname", myvalue);
check out documentation page list of differences .trigger()
.
Comments
Post a Comment