Disable and grey out fields (or div)

genegun 01 Apr, 2013
Hi, I am trying to get some fields to disable and grey out (lighttext) upon selecting a particular radio button.
Any idea?

thanks
GreyHead 01 Apr, 2013
Hi genegun,

If you give both inputs ids then you can easily do this with JavaScript.

Bob
genegun 02 Apr, 2013
Thanks for the reply, here is what I am using:

<script type="text/javascript">
window.onload = function() {
document.getElementById("input_checkbox_46").onclick = disableThem;
}
function disableThem(){
if (document.getElementById("input_checkbox_46").checked)  {
 document.getElementById("input_radio_28_1").disabled = true;
 document.getElementById("div_name").disabled = true;
 document.getElementById("autoID-5747298c29f2ba659810d0f95615f660_container_div").disabled = true;
 } else {
 	document.getElementById("input_radio_28_1").disabled = false;
 	document.getElementById("div_name").disabled = false;
 	document.getElementById("autoID-5747298c29f2ba659810d0f95615f660_container_div").disabled = false;
 	}
}
</script>


The code works to disable the individual "input_radio_28_1"
However, it does not disable the text area below it with the id "autoID-5747298c29f2ba659810d0f95615f660_container_div", nor the <div id="div_name"> that I setup around the entire section I want to disactivate.

EDIT: Ok I got it working by manually ascribing ID to each input. Problem solved thanks🙂
This topic is locked and no more replies can be posted.