2
I want, by means of a script (Javascript pure and simple), alert after the click in a given link (class "get out of") The following: "You are leaving the site".
Man script is like this:
window.document.querySelectorAll('.**sair**').onclick = function aviso() {
alert('Você está saindo do site.');
};
The class "get out of" is in the HTML markup section, below:
<p><a href="http://www.google.com" title="www.google.com" class="botao sair">Google</a></p>
When I activate the link, he alerts absolutely nothing.
Observing
I tried with the script:
window.document.getElementsByClassName('sair').onclick = function aviso() {
alert('Você está saindo da página.');
};
And it didn’t work either.
What is wrong?!
From now on, thank you,
Alexandre Soares
You’re calling the class
botao sairin HTML (class="botao sair"), and using.sair(.'sair').onclick) in javascript. At least one of the problems should be this (I tested here changing and still not opened). But soon someone will come up with the solution. :-)– gustavox
Thank you, Gustavo!
– Alexandre Soares