I want to create a 'closed' object (sorry, not sure what the right
term is), e.g.
var myObj = {
foo : function() {
$("#myLink").click(function(){
// How can I call the bar() method from here? What I would
// really like to be able to do is call...
// this.bar();
// But this doesn't work.
//
// The only way I can resolve it is by calling...
// myObj.bar();
// Which doesn't make this class very flexible
});
},
bar : function(){
}
};
As indicated above, I want to be able to call another method in the
object from within the contained jQuery event handler and I can't find
an elegant/flexible way of doing this by referencing the object
instance.
Any advice would be appreciated.