I’ve got this code:
function drawing(){
this.dragging = function(){
$('#object').mousedown(startDragging);
}
function startDragging(){
console.log(e.PageX);
}
}
var draw = new drawing();
$('#object2').click(function(e){
draw.dragging();
})
and when Im traing to fire this up i got in console ‘undefined’ can anybody tell me where is my mistake?
thanks!
You need to pass the
eventobject around if you want to reference it elsewhere (edoesn’t exist until you define it somehow). This should work: