javascript void functions

javascript void functions


This operator allows inserting expressions that produce side effects
into places where an expression that evaluates to undefined is

The void operator is often used merely to obtain the undefined
primitive value
, usually using void(0) (which is equivalent to void
0). In these cases, the global variable undefined can be used instead
(assuming it has not been assigned to a non-default value).
Note, however, that the javascript: pseudo protocol is discouraged over other alternatives, such as unobtrusive event handlers.

You can read more on this similar thread: What does javascript:void(0) mean?

void is an operator that is used to return a undefined value so the browser will not be able to load a new page. An important thing to note about the void operator is that it requires a value and cannot be used by itself.

javascript void functions

javascript:void(0) can be considered as Do nothing. Not sure what was intended to be achieved with it here. If you wanted to prevent form submission on button click, you should have used something like

<input type=submit value=submit onClick=return false; />

Leave a Reply

Your email address will not be published.