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?
a:link
works with the href being present only. If there isn't an href, it is only an anchor and not a link.
a {text-decoration: underline;}
a{
text-decoration: underline;
cursor: pointer;
}
a:hover{
text-decoration: none;
}
只需添加href属性,但通过取消事件使链接不执行任何操作。
<a href="#" onclick="event.preventDefault(); return false;" id="javascriptlink">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.