Example showing how using 'this' in a function depends on where 'this' is defined. From book jQuery in Action.
- //Let ID equal a string
- this.id = 'someID';
- //Set function outer to this
- var outer = this;
- * Since outer is being pulled in from outside the function, it still
- * retains the external context to this. Alert will be 'someID'
You need to login to post a comment.