Show/hide div on checkbox


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <script type="text/javascript">
  2. <!--
  3. function showMe (it, box) {
  4. var vis = (box.checked) ? "block" : "none";
  5. document.getElementById(it).style.display = vis;
  6. }
  7. //-->
  8. </script>
  9.  
  10. <input type="checkbox" name="modtype" value="value1" onclick="showMe('div1', this)" />

URL: http://www.dynamicdrive.com/forums/showthread.php?t=27245

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.