Generally, we set the href attribute of the tag that is not oriented #
1 <a href = "#"> Delete </a>
For example, when we do not need to add or delete a new link, we do not need to do any guidance, but click this link to execute a string of javascript code.
However, when the position of tag a exceeds the page scroll bar, the link we click does not have any orientation, but the page returns to the top.
This is very bad. It can be said that the user experience is quite poor.
The reason is # It can be regarded as an anchor link. When we click
1 <a href = "#"> Delete </a>
The page is directed to the top
So how can we solve this problem?
We can change the code to this
1 <a href = "javascript: void (0)"> Delete </a>
Or
1 <a href = "javascript: return false"> Delete </a>
Even if the page exceeds the scroll bar, when we click the link, the page will not return to the top.