What is the difference between calling a JavaScript function directly like onClick="a()" and onClick="javascript:a()"?

Nitesh Naveen

When a script is expected, there is no difference and you don't need the 'javascript:' there... It is used where the expected input is not a script. For example, in the href of anchor tag if you want to call a JavaScript function when you click on the link instead of a url which is the default expected input.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.