The difference between html empty link href="#" and href="javascript:void(0)"

The difference between html empty link href="#" and href="javascript:void(0)"
# contains a location information. The default anchor is #top, which is the top of the web page. JavaScript:void(0) only indicates a dead link. This is why sometimes when a page is very long, the browse link is clearly #, but it jumps to the top of the page, while JavaScript:void(0) is not the case. Therefore, it is best to use void(0) when calling scripts.
You can test this using the following example:
Code

Tip: You can modify some of the code before running

<<:  Solution for Nginx installation without generating sbin directory

>>:  New ideas for time formatting in JavaScript toLocaleString()

Recommend

Example code for hiding element scrollbars using CSS

How can I hide the scrollbars while still being a...

How to Fix File System Errors in Linux Using ‘fsck’

Preface The file system is responsible for organi...

MySql index detailed introduction and correct use method

MySql index detailed introduction and correct use...

Sample code for displaying a scroll bar after the HTML page is zoomed out

Here is a record of how to make a scroll bar appe...

Vue.js style layout Flutter business development common skills

Correspondence between flutter and css in shadow ...

Win10 uses Tsinghua source to quickly install pytorch-GPU version (recommended)

Check whether your cuda is installed Type in the ...

Analysis of the advantages and disadvantages of MySQL stored procedures

MySQL version 5.0 began to support stored procedu...

Common usage of hook in react

Table of contents 1. What is a hook? 2. Why does ...

Example of deploying MySQL on Docker

Table of contents 1 What is container cloud? 2 In...

5 ways to quickly remove the blank space of Inline-Block in HTML

The inline-block property value becomes very usef...

js to achieve simple accordion effect

This article shares the specific code of js to ac...

Introduction to the functions and usage of value and name attributes in Html

1. The value used in the button refers to the text...

How to solve the 2002 error when installing MySQL database on Alibaba Cloud

The following error occurred while installing the...

How to export CSV file with header in mysql

Refer to the official document http://dev.mysql.c...