bind event to id not work..

60 views
Skip to first unread message

Mohamed Arif

unread,
Nov 3, 2012, 5:10:56 AM11/3/12
to raph...@googlegroups.com
My code :

var paper new Raphael('slideContainer',300,300);
var circle paper.circle(150,150,100).attr({'fill':'green'});
circle.data('id','myCircle');

paper.getById('myCircle').click(function(){
    alert('hi');
})


but not working at all.. any reason? live here : http://jsfiddle.net/XSpHX/

charles thomas

unread,
Nov 3, 2012, 5:24:49 AM11/3/12
to raph...@googlegroups.com
var circle = paper.circle(150,150,100).attr({'fill':'green'});
//circle.data('id','myCircle');
circle.data('id',circle );

circle.data('id').click(function(){
    alert('hi');
})

//I would have done it like this
var circle2= paper.circle(350,150,100).attr({'fill':'#f00'});

circle2.click(function(){
    alert('hi 2');
})


From: Mohamed Arif <3gweb...@gmail.com>
To: raph...@googlegroups.com
Sent: Saturday, November 3, 2012 9:10:56 AM
Subject: bind event to id not work..

--
You received this message because you are subscribed to the Google Groups "Raphaël" group.
To view this discussion on the web, visit https://groups.google.com/d/msg/raphaeljs/-/YdkB-E23DFkJ.
To post to this group, send an email to raph...@googlegroups.com.
To unsubscribe from this group, send email to raphaeljs+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/raphaeljs?hl=en-GB.


Sebastian Gurin

unread,
Nov 8, 2012, 11:24:15 AM11/8/12
to raph...@googlegroups.com
for this to work it should be

circle.id="myCircle"

and then yes,

paper.getById('myCircle').click....
Reply all
Reply to author
Forward
0 new messages