Skip to content Skip to sidebar Skip to footer

What Is The Use Of 'javascript:methodname(); In An Anchor Link?

What is the use of 'javascript:methodName(); in an anchor link? I have seen the following in some code. What is use of the 'javascript:'?

It is of no use in this case and instead of javascript you could use any other word there.

It is probably only (mistakenly!) used because one typically sees this in the href attribute (where javascript: is a pseudo-scheme):

href="javascript:getUserName()"

but it has a totally different meaning in on* attributes.

Related: Do you ever need to specify 'javascript:' in an onclick?

Post a Comment for "What Is The Use Of 'javascript:methodname(); In An Anchor Link?"