Understanding "javascript : ... ;" inside <a href=" ">
html, javascript
Solution
IF you need to pass a javascript snippet which needs to run instead of the default behavior of an element then you use this `javascript: ;` syntax.
For example
<a href="javascript:alert('');">Test</a> <!-- Runs on the click of the link -->
Similarly, you can combine these on other events also, like `onclick`, `onchange` etc but this is really not necessary, since you can execute the snippet, directly.
The uses of this, i have seen in years are:
- `<a href="javascript:void(0);">Test</a>`
- `<form action="javascript:void(0);">..</form>`
Problem
What is the meanign of `javascript:;` that is kept inside the `href` attribute in an link? Like ``` <a href="javascript: ... ;">Link</a> ```