<script type="text/javascript">
function disablefield(){
if (document.getElementById('yes_radio').checked == 1){
document.getElementById('forenoon').disabled='disabled';
document.getElementById('forenoon');
document.getElementById('afternoon').disabled='disabled';
document.getElementById('afternoon');
}else{
document.getElementById('forenoon').disabled='';
document.getElementById('forenoon');
document.getElementById('afternoon').disabled='';
document.getElementById('afternoon');
}
}
</script>
<table>
<tr>
<td align="right" valign="top"> </td>
<td colspan="2">
<input type="radio" name="from" id="no_radio" onChange="disablefield();" value="0.5" />
<strong>Half Day
<input type="radio" name="from" id="yes_radio" onChange="disablefield();" value="1" checked="checked" />
Full Day</strong></td>
<td> </td>
</tr>
<tr>
<td align="right" valign="top"> </td>
<td colspan="2">
<input type="radio" name="half_day1" id="forenoon" value="Forenoon" />
<strong>Forenoon
<input type="radio" name="half_day1" id="afternoon" value="Afternoon" />
Afternoon</strong></td>
<td> </td>
</tr>
</table>
If want that on page load by default fullday is selected and forenoon and afternoon will be disabled. but if halfday will be selected then forenoon and afternoon will be enabled.
plz help......
Disable radio button on page load
Moderator: General Moderators
Re: Disable radio button on page load
Hi,Check this FIddlehttp://jsfiddle.net/mmuU6/.it uses jquery .
It is not the right place for posting javascript queries,pls post in javascript section.
Hope it helps
It is not the right place for posting javascript queries,pls post in javascript section.
Hope it helps
Re: Disable radio button on page load
this code really worked ...................
thanx.............
thanx.............