If, if else and else onclick | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

If, if else and else onclick

I need help with onclick for example html <button Id="yes">click me</button> <script> var yes = document.getElementById("yes"); if (yes.clicked == true) { promt("name"); } </script>

3rd Dec 2016, 8:38 PM
Juan Madrigal
Juan Madrigal - avatar
3 Respostas
+ 1
yes.addEventListener("click", function(e) { prompt("name"); }, false);
3rd Dec 2016, 8:58 PM
OndŇôej Donńõk
OndŇôej Donńõk - avatar
+ 1
Replace your script with this: document.addEventListener("DOMContentLoaded", function() { var yes = document.getElementById("yes"); yes.addEventListener("click", function() { prompt("test"); }, false); }, false);
3rd Dec 2016, 9:42 PM
OndŇôej Donńõk
OndŇôej Donńõk - avatar
0
yesyes
23rd Oct 2018, 4:02 AM
Lilisharyati