html button onpress code example
Example 1: button functions html
<script>
function myFunction() {
alert("ALERT");
}
</script>
<button onclick="myFunction">Click</button>
Example 2: javascript click event
<button onclick="myFunction()">Click me</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Hello World";
}
</script>