JSFiddle - React, Tailwind, and code Playground
by vi161
HTML
<h1>
multiselect to checkboxes
</h1>
<div class="myform">
<select class="multipleSelect" id="00N46000001prf3" multiple="multiple" name="Contraindication__c" title="Contraindication">
<option value="Pacemaker">Pacemaker</option>
<option value="Implanted defibrillator">Implanted defibrillator</option>
<option value="Any other electronic implanted device">Any other electronic implanted device</option>
</select>
<input id="field2-1" class="rad rad-y" type="checkbox" required name="rad-00N46000001prf3" value="Pacemaker">
<input id="field2-3" class="rad rad-y" type="checkbox" required name="rad-00N46000001prf3" value="Implanted defibrillator">
<input id="field2-5" class="rad rad-y" type="checkbox" required name="rad-00N46000001prf3" value="Any other electronic implanted device">
</div>
<p class="info">
</p>
JavaScript
$('.myform').change(function() {
var selectedCheck = [];
$($(this).find("select.multipleSelect option:checked")).each(function() {
selectedCheck.push($(this).val());
});
console.log(selectedCheck);
$(this).find("input.rad").val(selectedCheck);
});