Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
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");
Add a comment
Use the following code:
jQuery('myelement').css("cursor", "pointer");
This can also be done in pure CSS with cursor:pointer.
cursor:pointer
$("myelement").css("cursor", "pointer");
You use the CSS cursor property for this. Directly with CSS:
cursor
#id { cursor: pointer; }
Or with jQuery using css():
css()
$("#id").css("cursor", "pointer");
Or with Javascript:
document.getElementById("id").style.cursor = "pointer";
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");
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.