I want to create a link that does NOTHING, it means that its a fake link
Im trying with onclick="mijava();return false;" but it scrolls up in the website
How can I do it?
javascript:
document.getElementById("nothing").addEventListener("click", function(event){
event.preventDefault()
});
html:
<a id="nothing" href="#">Link</a>
This won't do anything.
<a href="">Link</a>
preventDefault()
it
Oct 22, 2015 at 16:51
You can use CSS to style it like a link and you probably don't want to use an anchor tag if it's not going to act like one.
See this answer: How to make an anchor tag refer to nothing?
a
element that does nothing will solve it. So... what is the issue you're trying to solve?