I am doing a loop function to make the circles, i decided to link the circles to drawing lines between the objects, so, the first circle is draw i should get the ‘cx’ and ‘cy’ of the object and i will start to draw the line.
for that, in case of jquery we can get the final element as using ‘:last’ selector, i am trying with raphael, any one help me to get the last element of each drawing.
my function:
var paper = new Raphael('paper',500,500);
var circle1 = paper.circle(50,50,50).attr({fill:'green'});
var circle2 = paper.circle(200,50,50).attr({fill:'red'});
$(paper.node,':first').click(function(){
alert(this.atrr('x'));
})
$(paper.node,':last').click(function(){
alert(this.atrr('x'));
})
Your functions are not correctly setted, you should use it like this:
http://jsfiddle.net/S6REC/