Home >Web Front-end >HTML Tutorial >Jump to the address pointed to by href after the click event of html hyperlink a_HTML/Xhtml_Web page production
Sometimes, we need to use the hyperlink instead of using href to complete the jump, but like this: . In this way, the page will not jump. But it will also bring some negative problems, such as the title of the page changing to "#", or scroll bars appearing on the page. This is because after executing the onClick event, jumps to the address pointed to by the href again, and "#" is an anchor point, which defaults to the top of the web page, so it will cause the problems mentioned above.
There are two solutions:
1. Add a return false statement to the onClick event, for example:
Click
2 , use void(0) instead of #, for example:
Click