Reputation: 57
Senario: I write "anchor" tag,inside it i give "href".After that requirement is that when i click on the link it should do nothing,but we cannot left empty "href" tag too.How could this possible?
Upvotes: 0
Views: 1398
Reputation: 718
kindly use
<a href="#"></a>
This should solve your issue.
since the HREF may also be used to identify sections within a document, the HREF contains two components: the URL, which is the actual link, and the clickable text that appears on the page, called the "anchor text."
you could use
<a href="#idOfTheAnchorText"></a>
or
href="javascript:void(0);"
which essentially means that a void do nothing since evaluation of 0 using void calculates to undefined
primitive value.
Upvotes: 2
Reputation: 413
Standard practice way of declaring empty href
would be to use href="#"
or href="javascript:void(0);"
Explanation:
href="#"
it's a simple and quick fix, but adds an extra entry to the browser history when clicked.
<a href="javascript:void(0);" class="arrow">Link</a>
explicitly add a null-effect href attribute, so when clicked it doesn't have any effect and also does't mess with the browser history.
Upvotes: 2