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>
3 Antworten
+ 1
yes.addEventListener("click", function(e) { prompt("name"); }, false);
+ 1
Replace your script with this:
document.addEventListener("DOMContentLoaded", function() {
var yes = document.getElementById("yes");
yes.addEventListener("click", function() {
prompt("test");
}, false);
}, false);
0
yesyes