Reputation: 14219
I have the following jQuery:
var paper = Raphael(0, 20, 500, 500);
var robot = paper.image("http://jackdent.co.uk/arrow-right.jpg", 0, 0, 20, 20);
robot.node.setAttribute('id', 'robot');
$('#submit').on('click', function () {
$('#robot').rotate(90);
})
I need for certain reasons to access the robot element using an id assigned to it. I want to rotate the image 90 degrees when the client clicks a button. Currently my code is erroneous, and I can't figure out why.
Any help would be much appreciated, thanks in advance.
See a live example here
Upvotes: 1
Views: 2623
Reputation: 4678
Use:
robot.rotate(90);
instead of
$('#robot').rotate(90);
Demo: http://jsfiddle.net/Vre9W/18/
Upvotes: 5