onclick event for button code example
Example: button functions html
<script>
function myFunction() {
alert("ALERT");
}
</script>
<button onclick="myFunction">Click</button>
<script>
function myFunction() {
alert("ALERT");
}
</script>
<button onclick="myFunction">Click</button>