Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make a html element appear clickable with JQuery / JS

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.

like image 439
tinny Avatar asked Dec 22 '22 01:12

tinny


2 Answers

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");
like image 126
Dean Harding Avatar answered Jan 12 '23 23:01

Dean Harding


Use the following code:

jQuery('myelement').css("cursor", "pointer");

This can also be done in pure CSS with cursor:pointer.

like image 33
Aaron Harun Avatar answered Jan 12 '23 22:01

Aaron Harun