Return to Snippet

Revision: 45187
at April 27, 2011 02:28 by 1man


Initial Code
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')

Initial URL
http://jqfundamentals.com/book/index.html

Initial Description
Rather that using $(element).trigger('click'), check to see if execute has come from an element rather than directly.

Initial Title
Check to see if function triggered by an event

Initial Tags
event

Initial Language
jQuery