In case we have to execute a JavaScript function on click
of the element, we can use this approach.
<script>
function TestFunction() {
alert("Click event fired.")
}
</script>
<input type="button" id="btnTest" onclick="TestFunction()" value="Click me" />
In the above code snippet, TestFunction() fires when user clicks on the "Click me" button.
OUTPUT
Views: 6989 | Post Order: 31