I am using nice select dropdown, which has multiple options that i can check or uncheck.
Issue here is that I can either check or uncheck all options and what needed is checking particular checkboxes on load of page.
I tried a lot and also added these lines.
$('#Person').val("1").prop('checked', true);
$("#Person").niceSelect("update");
While executing this shows "checked: true" in console,but changes don't reflect on page.
For unchecking all checkboxes I am using below code.
$(".styled-checkbox").prop('checked', false);
<div class="box"><div class="nice-select wide" tabindex="0" id="Person"></div></div>
$('#Person').val("1").prop('checked', true);
$("input[type=checkbox][value=" + xy + "]").attr("checked", "true");
$("#Person").val(xy);
$('#Person').val(xy).prop('selected', true);
$('#Person').val(xy);
$('#Person').multiSelect('select', [2, 1]);
$("#Person option[value='2']").prop('selected', true);
$("#Person option[value='2']").attr("selected", true);
How to set checked or unchecked checkbox using its value?