html – <a>Can</a> &quot; <a>&quot;</a> tag <a>be used without the &quot;href&quot;?</a>

Question:

Are there any restrictions or problems in using the tag a without the attribute href ?

Example: <a>teste</a> .

Answer:

In HTML5 it is valid and can be used to later be completed by a script , as indicated in the official documentation . Something like:

document.getElementById("link").href = "http://pt.stackoverflow.com";
<a id="link">Vai ter um link aqui</a>

I put it on GitHub for future reference .

Scroll to Top