1. Computing & Technology

"self" and Multiple Objects

From Stephen Chapman, About.com GuideMay 18, 2011

When attaching event handlers/listeners to objects some browsers assume "this" refers to the object the handler is attached to and others assume it is referencing the object that triggered the event. To make sure we are referencing the right object we assign "this" to another name when we define the original object. Most people use "self" as that name.

"self" and Multiple Objects

Comments
No comments yet.  Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2012 About.com. All rights reserved.

A part of The New York Times Company.