On 14/02/2008, kojilab <[EMAIL PROTECTED]> wrote: > > Hi, > > I have a class with DOM elements as properties. I want to bind events > within the class to the ements. Unfortunately I am getting an error > telling me those properties are not defined. Here's an simplfied > example of what I'm trying to achieve. > > var MyClass=Class.create() > MyClass.prototye = { > initialize: function(element1, element2){ > this.element1=element1; > this.element2=element2; > > }, > > hide: function(){ > this.element2.hide(); > } > }
Can you try ... var MyClass=Class.create() MyClass.prototye = { initialize: function(element1, element2){ this.element1=$(element1); this.element2=$(element2); this.element1.observe('click', this.hide).bindAsEventListener(this); }, hide: function(){ this.element2.hide(); } } Not sure what you are observing, so chose click. -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!" --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype: Core" group. To post to this group, send email to prototype-core@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-core?hl=en -~----------~----~----~----~------~----~------~--~---