In JavaScript, Void is an operator that specifies that an expression is evaluated but does not return a value.
The void operator uses the following format:
1. Javascript:void (expression)
2. Javascript:void expression
Expression is a standard of JavaScript to evaluate. Parentheses on the outside of the expression are optional, but writing is a good habit. We can use the void operator to specify hyperlinks. The expression is evaluated but does not load anything at the current document. The code for the polygon creates a hyperlink that doesn't happen when the user clicks it. void (0) evaluates to 0 when the user clicks on the link, but does not have any effect on JavaScript.
<a href= "javascript:void (0)" > Click here Nothing will happen </a>
That is , you can use void (0) to perform some processing but not to refresh the page as a whole, but be careful when you need to refresh the page.
when calling from this custom JS function, if we use <a href= "#" onclick= "method;" >click</a>, although the method can be executed, but if the page contains scroll bars, will automatically scroll to the top of the page, if this time we use <a href= "javascript:void (0); Onclick= "method;" >click</a>, when executed, the page will not scroll, which should be very useful for image switching, Ajax calls.
A href= "javascript:void (0)"