I have a multi select dropdown and two radio buttons. By default No should be checked and the drop down should be disabled. On change to Yes it should be enabled but it's not working. I'm not sure what I am doing wrong here.
This is my html:
<div class="form-group">
<label>Action Taken:</label>
<input type="radio" class="check" name="check" value="Yes">Yes
<input type="radio" class="check" name="check" value="No" checked>No
<select name="action[]" id="action" multiple class="action form-control" disabled>
<option value="Offcycle Salary Revision">Offcycle Salary Revision</option>
</select>
This is my javascript:
<script>
$('.check').change(function(){
let select = $(this).parents('.form-group:first').find('select') ;
if( $(this).val() == 'Yes')
select.attr('disabled' , false );
else
select.attr('disabled' , true );
});
</script>
This is my javascript for multiselect:
$('#action').multiselect({
nonSelectedText: 'Select Action',
buttonWidth:'465px',
maxHeight:450,
includeSelectAllOption: true
});
Can someone tell me what I am doing wrong here? It's working fine for a single select dropdown.