What javascript:nameFunction(); does?

Asked

Viewed 39 times

0

Hello I am Javascript beginner and snooping the code of others I found the following excerpt:

javascript:nomeDeFuncao();

What does it do?

I’ve seen code like this:

nomeDeFuncao();

But this part of " "is news to me. (I found this by Devtools Breakpoints)

Thanks in advance for the help.

1 answer

-1


You probably saw the use of javascript: within a link.

It is a widely used practice to invoke a javascript in the link click:

<a href="javascript:alert('HELLO');"> H E L L O</a>

  • Hello young, very interesting. I can use this in other types of attributes?

  • yes: You can use for example: onClick="javascript:foo()".

  • onClick="foo()" would work too

  • To the staff that is negatively, it is important to inform the reason.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.