Why should we use href = & quot; javascript: void (0) & quot;, hrefvoid

Source: Internet
Author: User

Why should we use href = "javascript: void (0)", hrefvoid

Our friends who have done web Front-end UI know that sometimes we use some superlinks on the web page, and these links do not need to point to any address, but only exist in concert with the javascript onclick event, when we click these links (which can also be seen as a time button), some interactive interfaces (such as Tab switching and initiating an asynchronous request) will appear on the webpage.

When you do not need to direct a link to an address, you do not need to set the href attribute. You may also find that the href attribute of similar links on some pages is set '#', this is similar to <a href = "#"> link text </a>. When we click these links, the browser will jump to 'Your url '/#, such a link address leads to a webpage jump to the header, but you may not be able to see the changes in the local area you just clicked. Therefore, we recommend that you do not use this method, you must use <a href = "javascript: void (0)"> your address </a> to avoid any redirection and refresh, the fruits of your work can be presented beautifully.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.