hello i have just start using Raphael but i’m very confused in the following code
WHY this code works
var paper = Raphael("canvas_container", 320, 200);
var mycir = paper.circle(50, 40, 30);
mycir.node.onclick = function() { alert("any thing") }
AND this doesn’t
var paper = Raphael("canvas_container", 320, 200);
var mycir = paper.circle(50, 40, 30);
mycir.click = function() { alert("any thing") }
i also tried and it didn’t work :
mycir.click(function(){alert("any thing")});
what the diffrence ? when i look at the raphaeal document they use Element.click() . why can’t i use it them , is this is my version or What ?
The problem is that you are trying to assign to click, instead of calling it.
This should work:
Note that Raphael recommends not to use
.node(as it says: “Don’t mess with it.”)