Revision: 42380
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 4, 2011 03:53 by beneberle
Initial Code
<script type="text/javascript">
<!--
function showhide(what,obj) {
// alert(what);
if(what != "1") {
obj1 = document.getElementById(obj);
obj1.style.display = '';
} else {
   obj1 = document.getElementById(obj);
  obj1.style.display = 'none';
}
}
function hide(obj) {
// alert(obj);
obj1 = document.getElementById(obj);
obj1.style.display = 'none';
}
//-->
</script>
<!-- HTML form element that triggers toggle -->
<input class="inputbox" type="radio" name="option" value="1" onchange="showhide(this.value,'toggle')" />Option 1<br/>
<!-- HTML element that toggles -->
<div id="toggle">This content will only be shown if option one is chosen</div>
Initial URL
Initial Description
This simple script toggles element visiblity on a page based on a form field's current value.
Initial Title
Simple Javascript Show/Hide for Form Elements
Initial Tags
javascript, html
Initial Language
JavaScript