I have languages field as shown in image. When I click on button hidden checkboxes div is shown and checkboxes are checked using comma delimited string. I can see those multiple values in a string. Loop is looping properly. But it's only setting checked for first language.
This is my js function for onclick button:
function populate(){
$("#hidden-box").removeClass("hidden");
var selected = $("#hiddenlanguagesinput").val().split(',');
for(var i=0; i < selected.length; i++){
$("#checkboxes-div input[type="checkbox"][value='"+selected[i]+"']").prop("checked", true);
}
}
As you can see, it's only checking first language.
Aucun commentaire:
Enregistrer un commentaire