Javascript Form How to - Handle click event from RadioButton








Question

We would like to know how to handle click event from RadioButton.

Answer


<!-- w  ww. ja v  a2 s.c o  m-->
<html>
<body>
    <form name="form1">
    <input type="radio" name=button1
    onClick='console.log("This mouse was clicked on this object")'>Box 1
    <br>
    </form>
</body>
</html>

The code above is rendered as follows: