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

Script For Login, Logout and View Using PHP, MySQL and Bootstrap

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

Customize radio buttons and checkboxes with CSS sprites