I have a lot of <a>
html tags without the href
attribute for making onclick
javascript calls. These links do not have a pointer style of cursor. They have text style cursor.
How can I set the cursor style to pointer for links without using the href
attribute?
I know I can add href="#". I have this in a lot of places in the html document, and would like to know how to make cursor style pointer for links without using the href
attribute.
This question is related to
javascript
html
css
hyperlink
cursor
This is how change the cursor from an arrow to a hand when you hover over a given object
(myObject).
myObject.style.cursor = 'pointer';
This worked for me:
<a onClick={this.openPopupbox} style={{cursor: 'pointer'}}>
Give them all a common class (for instance link). Then add in css-file:
.link { cursor: pointer; }
Or as @mxmissile suggested, do it inline with style="cursor: pointer;"
Use CSS cursor: pointer
if I remember correctly.
Either in your CSS file:
.link_cursor
{
cursor: pointer;
}
Then just add the following HTML to any elements you want to have the link cursor: class="link_cursor"
(the preferred method.)
Or use inline CSS:
<a style="cursor: pointer;">
style="cursor: pointer;"
Just add this to your global CSS style:
a { cursor: pointer; }
This way you're not dependent on the browser default cursor style anymore.
create a class with the following CSS and add it to your tags with onclick events:
cursor:pointer;
Source: Stackoverflow.com