Sometimes, we need to use the hyperlink <a> without using href to complete the jump, but like: <a href=# onClick=fun()></a>. This way, the page will not be redirected. But it will also bring about some negative problems, such as the title of the page becomes #, or the scroll bar appears on the page. This is because after executing the onClick event, <a> redirects the address pointed to by href, and # is an anchor point, which is the top of the page by default, so it will bring about the problem mentioned above.
There are two solutions:
1. Add a return false statement to the onClick event, for example:
<a href=# onClick=fun(); return false;>Click</a>
2. Use void(0) instead of #, for example:
<a href=javascript:void(0) onclick=fun()>Click</a>