javascript - How to checked checkbox after selecting selectpicker option?
Get the solution ↓↓↓Solution:
Use closest() and prop() instead of parent() and attr().
try this :
$(".selectpicker").on('change', function () {
var value = $(this).val();
if (value == "") {
$(this).closest(".div_img_part-2").find("input[type='checkbox']").prop('checked', false);
if ($("input:checked").length == 0) {
$('.disable').prop('disabled', false);
$('.selectpicker').selectpicker('refresh');
}
} else {
$(this).closest(".div_img_part-2").find("input[type='checkbox']").prop('checked', true);
}
});
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: the metadata storage is not up to date, please run the sync-metadata-storage command to fix this issue.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.