Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
173
rated 0 times [  180] [ 7]  / answers: 1 / hits: 64179  / 11 Years ago, sat, november 23, 2013, 12:00:00

I have a set of clickable identifiers on my page. About hundred, like 'cat1', 'cat2', 'dog1', 'dog2', 'dog3' etc. Then I have a function IDClick(id) {}



I need those identifiers clickable in HTML, to achieve that I used <a> tag with onclick



<a onclick=IDClick(id)>id</a>


now it works, but the cursor will not change when it is hovered over the clickable element.



So I try to add href=#



<a href=# onclick=IDClick(id)>id</a>


Now the cursor is OK, but when I click the item, the URL in the browser location bar will change. This is not desired.



How to get the mixed behavior?



I do not need underline as well.


More From » html

 Answers
23

You can use CSS to force the cursor to change on hover of the clickable element:



.myClickableThingy {
cursor: pointer;
}


And then you can switch back to <span>s or whatever of element you were using before <a> tags.


[#74105] Thursday, November 21, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
breap

Total Points: 606
Total Questions: 96
Total Answers: 108

Location: Djibouti
Member since Sun, Feb 27, 2022
2 Years ago
breap questions
Thu, Jun 24, 21, 00:00, 3 Years ago
Wed, Mar 18, 20, 00:00, 4 Years ago
Mon, Oct 7, 19, 00:00, 5 Years ago
;