/ Published in: jQuery

Rather that using $(element).trigger('click'), check to see if execute has come from an element rather than directly.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var foo = function(e) { if (e) { console.log(e); } else { console.log('this didn\'t come from an event!'); } }; $('p').click(foo); foo(); // instead of $('p').trigger('click')
URL: http://jqfundamentals.com/book/index.html
Comments
