I want to, by means of a pure and simple script ), to alert after the click on a given link (from the " exit ") the following: "You are leaving the site".
My script looks like this:
window.document.querySelectorAll('.**sair**').onclick = function aviso() {
alert('Você está saindo do site.');
};
The " exit " class is in the HTML markup section below:
<p><a href="http://www.google.com.br" title="www.google.com.br" class="botao sair">Google</a></p>
When I call link , it does not alert anything at all.
Note
I tried the script :
window.document.getElementsByClassName('sair').onclick = function aviso() {
alert('Você está saindo da página.');
};
And, it also did not work.
What's wrong ?!
Thanks in advance,
Alexandre Soares