JSFiddle - React, Tailwind, and code Playground

by John Kiran

HTML

<html>
<head>
  <meta charset="utf-8">
</head><body>

<table id="table">
  <tr>
    <td>Your age:</td>

    <td>
      <label>
        <input type="radio" name="age" value="young" checked> less than 18
      </label>
      <label>
        <input onclick="myFunction()" id="demo" type="radio" name="age" value="mature"> from 18 to 50
      </label>
      <label>
        <input type="radio" name="age" value="senior"> more than 60
      </label>
    </td>
  </tr>
</table>

<script>
function myFunction() {
    
  alert("hello");
  let inputs = table.getElementbyID("demo");

  alert(inputs);
    alert( inputs.value );
  }

</script>

</body>
</html>