I did search all over but i still cant fix it. Please help:
Here is my js code:
<script type="text/javascript">
$(document).ready(function() {
$("#email_acc").click(function() {
if ( $(this).is(":checked") ) {
$("#email_group").attr("enabled","enabled");
}
});
$("#system_acc").click(function() {
if ( $(this).is(":checked") ) {
$("#system_group").attr("enabled","enabled");
}
});
});
</script>
The following shows my html code:
<input type="checkbox" name="email_acc" id="email_acc" />Email Account
<input type="checkbox" name="sys_acc" id="sys_acc" />System Account
<input type="radio" name="radio_email" value="create" class="email_group" id="radio_email_0" disabled="disabled"/>New
<input type="radio" name="radio_email" value="change" id="radio_email_1" disabled="disabled"/>Change
<input type="radio" name="radio_email" value="terminate" id="radio_email_2" disabled="disabled"\ />Termination
<input type="radio" name="radio_system" value="create" class="system_group" id="radio_system_0" disabled="disabled"/>New
<input type="radio" name="radio_system" value="change" id="radio_system_1" disabled="disabled" />Change
<input type="radio" name="radio_system" value="terminate" id="radio_system_2" disabled="disabled" />Termination
I donno what is the problem.It just doesn't work.
$(document).ready(function()
{
$("#email_acc").click(function()
{
if ( $(this).is(":checked") )
{
$("input[name='radio_email']").removeAttr("disabled");
// ^----------------enable all the checkbox with common name
}
});
$("#sys_acc").click(function()
// ^---------corrected id
{
if ( $(this).is(":checked") )
{ $("input[name='radio_system']").removeAttr("disabled");
// ^----------------enable all the checkbox with common name
}
});
});
DEMO
DEMO 2
Code updated for new requirements from OP, cleaned code thanks to nnnnnn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With