Is there any way to use links without the <a href>
tag.
For example <a href="exemplo">exemplo</a>
is there another way to do this?
Is there any way to use links without the <a href>
tag.
For example <a href="exemplo">exemplo</a>
is there another way to do this?
The only alternative is using JavaScript, inline on HTLM, or with an event handler.
You should note that in terms of SEO and semantics the <a>
tag is the correct one to use. But if you still do not want to use an anchor you can use that (given the styling of the mouse pointer, how @bigown pointed out < a>):
HTML
<div id="link" data-link="site.com">exemplo</div>
JavaScript
document.getElementById('link').addEventListener('click', function () {
var href = this.dataset.link;
window.location = href;
});
HTML
<div onclick="location.href = 'site.com'">exemplo</div>
As a matter of curiosity, you can do this:
<a id="missionclick" class="moreinfo" style="cursor:pointer;">exemplo</a>
Obviously there is no need to avoid <a href>
.
Font .
You can do the following:
HTML
<a class="meuClick" style="cursor:pointer;">Aqui</a>
In your javascript :
$("a").on('click', '.meuClick', function()
{
//faça algo
}
Using this method, it even recognizes if it is a link coming from DOM (ie dynamic).