Reputation: 4257
Is it possible to make an html element appear clickable with JQuery?
By appear clickable I mean have the mouse pointer change appearance when the user hovers over the the element.
I dont want to use a tag.
Upvotes: 4
Views: 2264
Reputation: 5133
Set the style of the element to:
#elementId {
cursor:pointer;
}
You could do it with jQuery, but not sure why you'd want to? Here 'tis:
$(this).css("cursor", "pointer");
Upvotes: 1
Reputation: 34327
Use the following code:
jQuery('myelement').css("cursor", "pointer");
This can also be done in pure CSS with cursor:pointer
.
Upvotes: 2
Reputation: 72658
You don't do this with Javascript, you do it with CSS:
.whatever {
cursor: pointer;
}
You could do the same thing with jQuery if you really wanted, but all you're really doing is setting up the style:
$(".whatever").css("cursor", "pointer");
Upvotes: 6