which is better href="#"
or href="javascript:void();"
in terms of all aspects
like user experience, speed etc
is it necessary to put a 0 inside void when using href="javascript:void();"
.like this href="javascript:void(0);"
which is better href="#"
or href="javascript:void();"
in terms of all aspects
like user experience, speed etc
is it necessary to put a 0 inside void when using href="javascript:void();"
.like this href="javascript:void(0);"
If you don't need a link - don't use the <a>
element. You can use any other element (div
/span
) and attach a click event to it:
EL.addEventListener('click', function() { ... })
The EL
in the above example can by document.getElementById('#div-id')
for example or any other DOM
element.