Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

href value for null links [duplicate]

If I'm using an <a> tag click event to trigger an ajax call, and I don't want the link to physically go anywhere, what is the correct value for the href attribute?

Is it '#' or just leave it empty?

(I understand the accessibility issues that this brings).

like image 746
Chris J Allen Avatar asked Apr 05 '13 07:04

Chris J Allen


People also ask

What is href =# in HTML?

Definition and Usage. The href attribute specifies the URL of the page the link goes to. If the href attribute is not present, the <a> tag will not be a hyperlink. Tip: You can use href="#top" or href="#" to link to the top of the current page!

Can href be empty?

To answer your question: Yes it's valid. An <a> tag without a href represents something else, not a link (traditionally an anchor).

What is null link?

If the parser is unable to find a complete linkage for a sentence - one which links all the words together according to the requirements of the words - it begins to use "null-links". It begins by trying to parse the sentence, ignoring one word.


1 Answers

Better be # because some browsers won't render <a> with empty href(for example Google chrome will render the anchor as a plain text).

like image 133
gdoron is supporting Monica Avatar answered Oct 20 '22 14:10

gdoron is supporting Monica