Home  >  Article  >  Web Front-end  >  Explanation of the problem of automatically adding # sign to the URL address_javascript skills

Explanation of the problem of automatically adding # sign to the URL address_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:20:541131browse

In web development, sometimes when writing click events for hyperlinks, I like to write like this:

 Operation

Once I used jquery to submit an ajax request, the url parameters of the current page A # sign will be automatically added at the end. I was puzzled at first and struggled for a long time. It turned out to be a problem with this writing method. After replacing it with href="javascript:void(0);", the problem no longer occurred.

Note: # Contains a location information, the default anchor point is #top, which is the top of the web page, and javascript:void(0) only represents a dead link.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn