JSFiddle - React, Tailwind, and code Playground
HTML
<div id="Options">
<input id="choice_1" type="checkbox" name="choice_1" value="Option1"><label for="choice_1">Option1</label>
<input id="choice_2" type="checkbox" name="choice_2" value="Option2"><label for="choice_2">Option2</label>
<input id="choice_3" type="checkbox" name="choice_3" value="Option3"><label for="choice_3">Option3</label>
<input id="choice_4" type="checkbox" name="choice_4" value="Option4"><label for="choice_4">Option4</label>
<input id="choice_5" type="checkbox" name="choice_5" value="Option5"><label for="choice_5">Option5</label>
<input id="choice_6" type="checkbox" name="choice_6" value="Option6"><label for="choice_6">Option6</label>
<input id="choice_7" type="checkbox" name="choice_7" value="Option7"><label for="choice_7">Option7</label>
<input id="choice_8" type="checkbox" name="choice_8" value="Option8"><label for="choice_8">Option8</label>
<input id="choice_9" type="checkbox" name="choice_9" value="Option9"><label for="choice_9">Option9</label>
<input id="choice_10" type="checkbox" name="choice_10" value="Option10"><label for="choice_10">Option10</label>
</div>
<button>Test</button>
JavaScript
var choicesToSelect = ["Option1","Option9","Option3","Option4","Option2"];
selectHighlightCheckBoxes(choicesToSelect);
function selectHighlightCheckBoxes(choices){
$("#Options :input, label").removeAttr('checked').css({'border':'none', 'background-color':'none', 'font-weight':'normal'});
$.each(choices, function(intIndex, objValue) {
var option = $("#Options :input[value=" + objValue + "]"), toStyle = null;
if (option.is(":radio, :checkbox")) {
toStyle = option.attr('checked', true).next('label');
} else if ($(option).is(":text")) {
toStyle = option;
}
toStyle.css({ 'border': '1px solid #FF0000', 'background-color': '#BEF781', 'font-weight': 'bolder' });
});
}