Basically I am trying to set a disabled attribute on a select node, if the checkbox marked as a section is not set, if it is set, it should remove the attribute.
HTML:
<label>
<input type="radio" name="table" value="main_categories" checked>
Section</label>
<label>
<input type="radio" name="table" id="subcat" value="sub_categories">
Catégorie</label>
<select id="selectsec">
<option value="1">Test</option>
</select>
JQuery
$(document).ready(function() {
$('#subcat').change(function(){
if (!$('#subcat').is(":checked")) {
$('#selectsec').attr('disabled','disabled');
}
else {
$('#selectsec').removeAttr('disabled');
}
});
});
For some reason this does not work :(
source
share