Detailed explanation of the usage of javascript:void(0) in js

javascript:void(0) means do nothing.

E.g:

<a href="javascript:void(0);" onclick="alert('ok');"></a>  

 Here, it means that this link does not do jump action, and executes the onClick event.

Sometimes it can also be written like this:

<a href="####" >test</a>

 Use 2 to 4 #, most of which are "####", but also use "#all" and other others.

 

 

The difference between a href=# and a href=javascript:void(0):

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

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326706766&siteId=291194637