jquery Programming Glossary: this.bar
Public functions from within a jQuery plugin http://stackoverflow.com/questions/1034306/public-functions-from-within-a-jquery-plugin this.initialize function do something ... return this this.bar function do something ... return this.initialize jQuery Then..
jQuery/JavaScript “this” pointer confusion http://stackoverflow.com/questions/710542/jquery-javascript-this-pointer-confusion being the html element a class with a method function foo this.bar when called here this is the foo instance var barf this.bar.. when called here this is the foo instance var barf this.bar barf when called here this is the global object when called.. of javascript scope and closure. For the short answer this.bar is executed under the scope of foo as this refers to foo var..
Public functions from within a jQuery plugin http://stackoverflow.com/questions/1034306/public-functions-from-within-a-jquery-plugin methods var foo function do something ... ... public methods this.initialize function do something ... return this this.bar function do something ... return this.initialize jQuery Then you can access any of your public methods var myPlugin '#id'..
jQuery/JavaScript “this” pointer confusion http://stackoverflow.com/questions/710542/jquery-javascript-this-pointer-confusion instance when bar is called from a click handler instead of being the html element a class with a method function foo this.bar when called here this is the foo instance var barf this.bar barf when called here this is the global object when called.. being the html element a class with a method function foo this.bar when called here this is the foo instance var barf this.bar barf when called here this is the global object when called from a click this is the html element #thing .after div click.. to the world of javascript D You have wandered into the realm of javascript scope and closure. For the short answer this.bar is executed under the scope of foo as this refers to foo var barf this.bar barf is executed under the global scope. this.bar..
|