It looks you were trying to pass scope to addEvent using a third argument, but it does not work that way. As Piotr showed, you need to bind the function.
On Wed, Feb 23, 2011 at 8:41 AM, Piotr Zalewa <[email protected]> wrote: > http://jsfiddle.net/zalun/GwxvG/2/ > > bind changes the scope, so this refers to the object and not to clicked > element. > If you're confused about what is "this" in a function simply > console.log(this) as a first thing in this function will give you a hint. > > zalun > > On 02/23/11 16:29, roark wrote: > > Hi Everyone. > > > > I've had a good read through the article Aaron wrote at > http://jqueryvsmootools.com > > and I'm really battling to understand scope or when to use "this" in > > my classes etc. > > > > I'm writing a class that will display a help context when you focus on > > a filed in a form. > > http://jsfiddle.net/roark/GwxvG/1/ > > > > When I click on a filed, i get "this.function_name" is not defined. > > Trying to search google for the term 'mootools "this" ' is not very > > successful as you can image so i was hoping soemone could have a look > > and let me know where I'm going wrong? > > > > Thanks > > Roark > > > -- > blog http://piotr.zalewa.info > jobs http://webdev.zalewa.info > twit http://twitter.com/zalun > face http://facebook.com/zaloon >
