run function with onclick code example
Example: run a function when a button has the onclick
<script>
function myFunction() {
alert("ALERT THIS FUNCTION HAS RUNNED");
}
</script>
<button onclick="myFunction">click to run function</button>
<script>
function myFunction() {
alert("ALERT THIS FUNCTION HAS RUNNED");
}
</script>
<button onclick="myFunction">click to run function</button>