Friday, June 1, 2012

Javascript "this" Keyword

The "this" keyword in JavaScript is contextual and refers to the element that it was called from.

If the context is a page, then it refers to the page. If the context is withing the "onclick" of an HTML element, then it refers to the HTML element.

Reference: http://www.quirksmode.org/js/this.html

No comments:

Post a Comment