<a href="javascript:expand()"> and <a href="#" onclick="javascript:expand()">
What's the difference?
I know the href="#"
is the more standard way nowadays to do it. My problem is I have a standard dropdown menu that expands/collapses when user clicks on toggle.
If I do href="#"
for the code below, whenever someone clicks on expand the page ALWAYS scroll right back to the top which isn't acceptable from a user friendly point.
If I use href="javascript:expand()"
when user clicks expand, the page doesn't move and everything is OK.
So will there be any problems if I just use href="javascript:expand()"
instead? or how do I fix the href="#"
so the page doesn't scroll back to the top whenever user clicks expand.
Thanks.
EDIT: I know this question may have been asked before, but i'm looking at it from my point of view. Im just asking for a suggestion rather than an explanation.