I have a selection field with 4 options. If option 1 is chosen, I want it to check a checkbox field (WHITE)
How do I
Try with a JS like this
$('select[name="opcoes"]').on('change', function(){
$('.checks').find('input[type="checkbox"]').each(function(){
$(this).prop('checked', false);
});
if($(this).val() !== ''){
$('input[data-id="'+$(this).val()+'"]').prop('checked', true);
}
});
I did a fiddle to demonstrate