Yngvarr

Generation

generate functionTue, 07 Feb 2023

get value onclick

<button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var x; if (confirm("Press a button!") == true) { x = "You pressed OK!"; } else { x = "You pressed Cancel!"; } document.getElementById("demo").innerHTML = x; } </script>

Javascript
Generate More

Questions about programming?Chat with your personal AI assistant