| jquery Programming Glossary: do_stuffHow to call functions that are nested inside a JQuery Plugin? http://stackoverflow.com/questions/1042072/how-to-call-functions-that-are-nested-inside-a-jquery-plugin  script script function .fn.foo function options do_stuff function console.log hello world works do_other_stuff function.. jQuery body .foo #click_me .click function .fn.foo.do_stuff.do_other_stuff doesn't work script  javascript jquery jquery.. name or the are added to the global namespace. so your do_stuff is a global function which is not what you want one way to do.. 
 Why doesn't this closure have access to the 'this' keyword? - jQuery http://stackoverflow.com/questions/3323189/why-doesnt-this-closure-have-access-to-the-this-keyword-jquery  code function myObject this.myHello hello this.myMethod do_stuff function do_stuff var myThis this .get 'http example.com' function.. this.myHello hello this.myMethod do_stuff function do_stuff var myThis this .get 'http example.com' function alert this.myHello.. of my original code I could come up with. The closure in do_stuff has access to the variables in that scope but apparently this.. 
 How to call functions that are nested inside a JQuery Plugin? http://stackoverflow.com/questions/1042072/how-to-call-functions-that-are-nested-inside-a-jquery-plugin  src http ajax.googleapis.com ajax libs jquery 1.3.2 jquery.min.js script script function .fn.foo function options do_stuff function console.log hello world works do_other_stuff function alert who are you  function function jQuery body .foo #click_me.. works do_other_stuff function alert who are you  function function jQuery body .foo #click_me .click function .fn.foo.do_stuff.do_other_stuff doesn't work script  javascript jquery jquery plugins closures   share improve this question   when you assign.. var keyword they either overwrite the local variable of that name or the are added to the global namespace. so your do_stuff is a global function which is not what you want one way to do what you want is to explicitly give where you want your function.. 
 Why doesn't this closure have access to the 'this' keyword? - jQuery http://stackoverflow.com/questions/3323189/why-doesnt-this-closure-have-access-to-the-this-keyword-jquery  find a satisfactory explanation as to what's going on in this code function myObject this.myHello hello this.myMethod do_stuff function do_stuff var myThis this .get 'http example.com' function alert this.myHello alert myThis.myHello var obj new myObject.. explanation as to what's going on in this code function myObject this.myHello hello this.myMethod do_stuff function do_stuff var myThis this .get 'http example.com' function alert this.myHello alert myThis.myHello var obj new myObject obj.myMethod.. should not be jQuery specific but this is the simplest form of my original code I could come up with. The closure in do_stuff has access to the variables in that scope but apparently this rule does not apply to the this keyword. Questions What happens.. 
 |