I am returning a JSON data structure that I split and populate my array like so:
var arrayValues = data.contents.split('|');
// arrayValues = 1,3,4
How can I check the corresponding checkboxes based on the array values?
My HTML looks like this:
<div id="divID">
<input type="checkbox" name="test" value="1" /> Test 1<br />
<input type="checkbox" name="test" value="2" /> Test 2<br />
<input type="checkbox" name="test" value="3" /> Test 3<br />
<input type="checkbox" name="test" value="4" /> Test 4<br />
<input type="checkbox" name="test" value="5" /> Test 5<br />
</div>