Doug
Doug

Reputation: 119

JavaScript Change Cursor Icon

I already have the conditions and everything worked out, only thing I need is the syntax in JavaScript to change the cursor to the hand, like the user has moused-over a link, and then I need the syntax to change the cursor to the arrow, like they moused-out of the link. Not much to it, just need the JavaScript syntax for changing cursors.

Only thing is this needs to work in IE, FF, Chrome, Safari, and preferably Opera.

Thanks in advance!

Upvotes: 4

Views: 6424

Answers (2)

chirag
chirag

Reputation: 1828

You would be done using below syntax.

$('.className').css('cursor' , 'pointer'); // using className Selector.

Or

$('#idName').css('cursor' , 'pointer');  //Using Id Selector.

Upvotes: 1

stevelove
stevelove

Reputation: 3204

First, I'm shocked this question has no answers and no comments about how easy it would be to Google the answer.

The syntax you're looking for is: object.style.cursor = 'pointer', where object is the DOM object for which you're trying to change the cursor.

Here's an example: http://jsfiddle.net/3q5Yh/

Upvotes: 9

Related Questions