jQuery and function scope

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-04-29T00:29:38Z Indexed on 2010/04/29 0:37 UTC
Read the original article Hit count: 323

Filed under:

Is this:

    ($.fn.myFunc = function() {
       var Dennis = function() { /*code */ }
       $('#Element').click(Dennis);
    })();

equivalent to:

    ($.fn.myFunc = function() {
       $('#Element').click(function() { /*code */ });
    })();

If not, can someone please explain the difference, and suggest the better route to take for both performance, function reuse and clarity of reading.

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery