pTutorial

New way to learn Programming

Java Script Error

Why javascript:void() will throw a javascript error

Often people get this error javascript:void() that makes developer headache. If you got this type of error check solution below.

It will throw the following JavaScript error

Java SCript and HTML

 <a href="javascript:void()" onclick="doSomeThing ()">Click Here</a>
When will you click on this link it will throw javascript:void() error.

Solution

You can simply avoid this type of error by passing zero(0) in between void see the example below.

Java SCript and HTML

 <a href="javascript:void(0)" onclick="doSomeThing ()">Click Here</a>

See Also


QUOTES OF THE DAY

To make your children capable of honesty is beginning of education.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER