I have some values from JSON ARRAY. The values are Value1,Value2,Value3 And I have checkbox in HTML with ID same like Value. I wanna auto checked the checkbox like values from JSON Array.
I try to do like below
var OtherPay = response.OtherPay;
var benefit = OtherPay.split(",");
var sum = benefit.length;
for (var i = 0; i < sum; i++) {
$('#'+benefit[i]).attr('checked',true);
}
Thanks before
Aucun commentaire:
Enregistrer un commentaire