I have a code
<a href="javascript:;" class="icon-chevron-down"></a>
in my template. What the meaning? from where the *.js file function called?
I have a code
<a href="javascript:;" class="icon-chevron-down"></a>
in my template. What the meaning? from where the *.js file function called?
What the meaning?
javascript;
is a pseudo-protocol meaning "What follows is JavaScript code". In browsers, you can use this in most places links are allowed (including bookmarks) to run code when the link is followed rather than going to a new page. (When you do it with a bookmark, it's called a "bookmarklet" — very handy.)
Your specific example:
<a href="javascript:;" class="icon-chevron-down"></a>
Defines a link that doesn't do anything (at an HTML level) when you click it, because the only JavaScript code is the ;
, which is just a statement terminator. So running that code has no effect. Presumably, there's some code on that page which handles the click
event on those links instead.
from where the *.js file function called?
There is no .js
file in your example; the full code is ;
(which doesn't do anything). If there were a function in the link instead, the function would have to already exist in the window's environment (as a global).
Example of a javascript:
link that actually does something:
<a href="javascript:alert('Hi there')">Click me</a>
As far as I understand this question, javascript:
mean "execute Javascript code after the :
. In your case nothing is there except ;
. So it has nothing to execute. It looks like a placeholder to do nothing.
It is equivalent to write href="#"
or href=""