<select name="feature1">
<option value="1">Enable</option>
<option value="0">Disable</option>
</select>
<input type="checkbox" name="feature2" />
<input type="checkbox" name="feature3" />
How do I disable 'feature2' and 'featured3' inputs when 'disable' in 'feature1' is selected?
Thanks
This automatically enables the items again when 'Enable' is selected, which I assume is also what you want.
$('select[name=feature1]').change(function() {
$('input[name=feature2],input[name=feature3]').attr('disabled', $(this).val() == '0');
});
I'm going to assume you have ID's the same as your element names, for simplicity
jQuery('#feature1').change(function() {
jQuery("#feature2, #feature3").attr("disabled", jQuery(this).val() == '0');
});
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