1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<button type="button">click</button>
<p></p>
<script>
var botao = window.document.getElementsByTagName("button")[0];
var paragrafo = window.document.getElementsByTagName("p")[0];
botao.onclick = function() {
paragrafo.textContent = "Você clicou!";
};
botao.onclick = function() {
window.alert("Você clicou!");
};
</script>
</body>
</html>
So I have this code my problem is that the first onclick
not only works the second onclick
, because this is happening and has to execute both?