I have some values from a JSON ARRAY. The values are Value1,Value2,Value3
and I have a checkbox in HTML with an ID the same as the Value.  
I want to auto-check the checkbox which has the value from the JSON Array.
I tried to do this with below code:
var OtherPay = response.OtherPay;
var benefit = OtherPay.split(",");
var sum = benefit.length;
for (var i = 0; i < sum; i++) {      
    $('#'+benefit[i]).attr('checked',true);
}
 
     
     
     
    