As you all know, it is very common to have this code:
<a href='#' class='edit'>Edit</a>
Then it connects to the event handler (using jQuery or any other hip these days)
or even with built-in js handlers
<a href='#' onclick='editThis()'>Edit</a>
I know this is a lazy way to show a pointer / pointer to a link to a link, but this can be easily fixed only with this css:
a { cursor:pointer; }
(This takes less time to write once in the stylesheet than writing href = '#' to each link)
The presence of href='#' also causes an annoying inconvenience, prompting the browser to go to the top of the page if, for some reason, the handler was not able to attach itself to the element (the mouse starts a happy user, an impatient type, ...)
My question is, is there any good reason to keep using href='#' ?
Will this remove the violation of browser behavior in several specific contexts?
EDIT . I get a really random answer to this question, maybe I should clarify.
Question: if I set the manual cursor (and underline and color - thanks Borealid) via css, can I completely get rid of the href attribute
This question is NOT about what is the best href or how to attach event handlers
source share