Note that it is the difference between jumping to the top of the page. It is better to use void(0) for better user experience.
#Contains a location information
The default anchor is #top, which is the top of the web page
And javascript:void(0) only represents a dead link
This is why sometimes The page is very long. The browsing link is obviously # but it jumps to the top of the page.
But javascript:void(0) is not the case.
So it is best to use void(0) when calling the script.
You can use the following example. Test it:
Code
这里是页首.....
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
这是会跳到页首的 这个不会跳动
Tips: You can modify part of the code before running
# #
The above is the detailed content of The difference between html empty link href='#' and href='javascript:void(0)'. For more information, please follow other related articles on the PHP Chinese website!