Getting value of HTML Checkbox from onclick/onchange events

 

<html><head>
</head>
<body>
  <div style="display: none;" id="container">Check Box is Checked</div>
<br><br>
<label>
    <input id="mycheckbox" onclick="myChange()" type="checkbox">
   
</label>
<script>
    function myChange(){
    var temp = document.getElementById('mycheckbox');
    document.getElementById('container').style.display = temp.checked ? 'block' : 'none';
};
    </script>
</body></html>

Comments

Popular posts from this blog

Real-Time Web Interface to MQTT using Socket.io and Node.js

Insert session variable into MySQL database

Insert CheckBox and Radio button Data in MySQL Database Using PHP