Powerofspeed
Powerofspeed

Reputation: 3

Changing cursor when hovering a text

I'd like to change the cursor to the pointer when hovering "text", since it links to a pop-up and not to a link, and i want to "hide" it between links. Is there a way?

<a onclick="myFunction()">Text</a>
<script>
function myFunction()
{
alert("pop-up text");
}
</script>

Thanks

Upvotes: 0

Views: 75

Answers (2)

kamilkp
kamilkp

Reputation: 9800

With CSS:

a{
    cursor: pointer;
}

If you want it not to be a pointer on specific items you can use a :not pseudo-class to match anchors with class="not-a-link":

a:not(.not-a-link){
    cursor: pointer;
}

Upvotes: 1

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382464

Simply set a css rule:

HTML :

<a class=someRelevantClass onclick="myFunction()">Text</a>

CSS :

a.someRelevantClass {
   cursor: pointer;
}

See the available cursors in the MDN.

Upvotes: 2

Related Questions