Javascript Form How to - Handle Button click event








Question

We would like to know how to Handle Button click event.

Answer



<html>
    <form name="myForm">
      <input type="button"
             value="Big Button"
             name="myButton"
             onClick="console.log('Click event occurred')">
    </form>
</html>

The code above is rendered as follows: