suppose I have a function:
function test(){}
test.prototype.method01=function(){
//do something
}
test.prototype.method02=function(){
//how can I call the method01?
//this.method01()...?
//but the chrome through an error:
//Uncaught TypeError: Object #<HTMLImageElement> has no method 'method01'
}
Edited: in fact the method01 like this:
test.prototype.method02=function(){
$('.cpy').resizable({
}).draggable({
start:function(e,ui){
this.method01();
}
});
}
method02
to an event of an image by any chance?method02
. You should read the MDN article aboutthis
.start
callback,this
refers to the element you calldraggable
on, in this case.cpy
. You have to keep a reference to thethis
ofmethod02
.