Thanks for the solution, works great.
On Jan 4, 7:02 pm, Balazs Endresz <balazs.endr...@gmail.com> wrote: > Hmm, I don't think you should do this: > Viewer = new Viewer; > this will overwrite your class and you can't instantiate it again! > > rather: > > initialize: function() > { > var self=this; > $("#thumbs img:first").click(function(){ > self.doX() > }); > }, > > or > > initialize: function() > { > var self=this; > $("#thumbs img:first").click(function(){ > var el=this; //this is the element here > (function(){ > this.doX(); //this refers to yourobjecthere > $(el).something(); > }).call(self); > }); > }, > > On Jan 4, 5:57 pm, "Alexandre Plennevaux" <aplennev...@gmail.com> > wrote: > > > this worked for me:http://jsbin.com/utahi > > > On Sun, Jan 4, 2009 at 5:31 PM, fatslags2...@gmail.com > > > <fatslags2...@googlemail.com> wrote: > > > > function Viewer() > > > { > > > > }; > > > > Viewer.prototype.constructor = Viewer; > > > > Viewer.prototype = > > > { > > > getFullAreaId: function() { return this._fullAreaId; }, > > > setFullAreaId: function(fullAreaId) { this._fullAreaId = > > > fullAreaId; }, > > > > initialize: function() > > > { > > > $("#thumbs img:first").click(/* execute this.doX on mouse > > > click */); > > > }, > > > > doX: function() > > > { > > > alert(this.getFullAreaId()); > > > } > > > }; > > > > How can I make the click event execute the doXmethod? > > > > Regards, > > > FatSlags2004