.prop
is the correct way to set the checkbox.
Your events are not being triggered because the click event doesn't fire.
Try .change
, note I adjusted the option
s to have the data as the value
attribute not the class
attribute. Either make sure the default select selection and the default checkboxes match (as they do in your example with user1) or manually trigger $('.select210').change()
You might also want to set .prop('disabled', true)
if you want to disallow users from changing these defaults.
fiddle
<select class='select210'>
<option value='user1'>wjazi@deloitte.com</option>
<option value='user2'>aschwem@company.com</option>
<option value='user3'>tcooksnow@usa.com</option>
</select>
<input type='checkbox' checked class='viewChk' />View
<input type='checkbox' checked class='editChk' />Edit
<input type='checkbox' checked class='delChk' />Delete
$('.select210').change(function(){
var value= $(this).val();
switch(value){
case 'user1':
$('.viewChk').prop('checked', true);
$('.editChk').prop('checked', true);
$('.delChk').prop('checked', true);
break;
case 'user2':
$('.viewChk').prop('checked', true);
$('.editChk').prop('checked', true);
$('.delChk').prop('checked', false);
break;
case 'user3':
$('.viewChk').prop('checked', true);
$('.editChk').prop('checked', false);
$('.delChk').prop('checked', false);
break;
}
});