Why not just use: myObj.OtherFunction();
On Jul 30, 9:53 am, Michael Lawson <mjlaw...@us.ibm.com> wrote: > Hmmm i'm not quite sure what you're trying to do exactly :) > > cheers > > Michael Lawson > Development Lead, Global Solutions, ibm.com > Phone: 1-276-206-8393 > E-mail: mjlaw...@us.ibm.com > > 'Whether one believes in a religion or not, > and whether one believes in rebirth or not, > there isn't anyone who doesn't appreciate kindness and compassion..' > > From: "#micah" <micah.a.sm...@gmail.com> > > > To: "jQuery (English)" <jquery-en@googlegroups.com> > > > Date: 07/30/2009 03:52 PM > > > Subject: [jQuery] Re: jQuery and the 'this' keyword > > > Would you recommend using the .bind(type, data, fn) function to > achieve what i'm trying to do? Or could you steer me in the right > direction? I'm surprised that the .click() works in that manner. How > would you dynamically assign that function to that button? > > On Jul 30, 3:48 pm, Michael Lawson <mjlaw...@us.ibm.com> wrote: > > > Because you are binding the click event to the button and not your object > > > cheers > > > Michael Lawson > > Development Lead, Global Solutions, ibm.com > > Phone: 1-276-206-8393 > > E-mail: mjlaw...@us.ibm.com > > > 'Whether one believes in a religion or not, > > and whether one believes in rebirth or not, > > there isn't anyone who doesn't appreciate kindness and compassion..' > > > From: "#micah" <micah.a.sm...@gmail.com> > > > To: "jQuery (English)" <jquery-en@googlegroups.com> > > > Date: 07/30/2009 03:45 PM > > > Subject: [jQuery] jQuery and the 'this' keyword > > > I've created a javascript object like so: > > > var myObj={ > > // internally used > > OtherFunction: function(){ alert('hi');}, > > > // externally used > > EditInfo: function(){ > > this.OtherFunction(); > > } > > > }; > > > if i bind EditInfo to a button, like so: > > > $('#myButton').click(myObj.EditInfo) > > > Then (this) is pointing to the button, not to myObj. Why is that? > > > I'm using FF3.5 > > > graycol.gif > > < 1KViewDownload > > > ecblank.gif > > < 1KViewDownload > > > > graycol.gif > < 1KViewDownload > > ecblank.gif > < 1KViewDownload