Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis0
A small question
Is it possible to actually use the Cancel and Ok in the confirm() command OR Do you have to type about 50 lines of code for a working confirm() command? (This is in web)
2 Respostas
+ 5
Kongpheng Lo yes by example of w3schools
https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_confirm2
<!DOCTYPE html>
<html>
<body>
<h1>The Window Object</h1>
<h2>The confirm() Method</h2>
<p>Click the button to display a confirm box.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
let text;
if (confirm("Press a button!") == true) {
text = "You pressed OK!";
} else {
text = "You canceled!";
}
document.getElementById("demo").innerHTML = text;
}
</script>
</body>
</html>
https://sololearn.com/compiler-playground/WJms7JFlgCy6/?ref=app
+ 1
Thanks