jQuery method to check if the event is triggered
- 2020-06-22 23:49:44
- OfStack
This article illustrates how jQuery checks to see if an event is triggered. Share to everybody for everybody reference. Specific implementation methods are as follows:
$('button').click(function(event, wasTriggered) {
if (wasTriggered) {
alert('triggered in code');
} else {
alert('triggered by mouse');
}
});
$('button').trigger('click', true);
Hopefully, this article has been helpful in your jQuery programming.