• All
  • Free Web Hosting
  • Category 2
gravatar

Show and Hide Text Box in Javascript.

Show and hide a textbox by simply using this code. Fully compatible to all browsers. Thanks to the original author of this script.

Insert this script in your <HEAD>.
<script type="text/javascript">
function doClick2(objRad3){
if (objRad3.value=="0"){
document.getElementById("textbox3").style.display='none'; //hide textbox
document.getElementById("otherOpt3").style.display='block'; //show other options
document.getElementById('CrimeDetails').value = 'N/A'; //this will be the default value upon dumping.
}
else{
document.getElementById("otherOpt3").style.display='none'; //hide other options
document.getElementById("textbox3").style.display='block'; //show textbox
document.getElementById('CrimeDetails').value = 'Please give details.';
}
}
</script>