Home >Web Front-end >JS Tutorial >jQuery method to check whether an event is triggered_jquery
The example in this article describes how jQuery checks whether an event is triggered. Share it with everyone for your reference. The specific implementation method is as follows:
$('button').click(function(event, wasTriggered) { if (wasTriggered) { alert('triggered in code'); } else { alert('triggered by mouse'); } }); $('button').trigger('click', true);
I hope this article will be helpful to everyone’s jQuery programming.