Alex Rivera | Logout

css underline for anchor without href

Asked 2012-06-25T06:45:29.827
13

I have an <a id="javascriptlink"> tag, without href. Its action handled by jquery onclick. So, I want to put in css a:link {text-decoration: underline;} and a:hover {text-decoration: none;} to make it look like a link.

However, the anchor underline seems to only work when href attribute is presented. Any idea?

Edit
Report

1 Answer

9

Just add the href attribute but make the link do nothing by canceling the event.

<a href="#" onclick="event.preventDefault(); return false;" id="javascriptlink">
answered 2012-06-25T06:57:41.450

Your Answer