Place a checkbox status from an input field, and add a js record with "push"

<input type = "checkbox" id = "C1" />
<input type = "checkbox" id = "C2" />
<input type = "checkbox" id = "C3" />
 
myArray = []; 
 
for (n = 1; n <= 48; n++) {

var x = document.getElementById("C" +n); // GRAB the checkmark input 
localStorage.setItem("S" +n +"_PAY", x.checked); // STORE the value in localStorage

var checked = JSON.parse(localStorage.getItem("S" +n +"_PAY")); // parse the localStorage variable
var mom = document.getElementById("C'.$i.'").checked = checked; // get a true or false value
 
 myArray.push ({

 paid:mom, // this just doesn't work. The syntax is wrong. Any suggestions would be helpful!
 name: $('#P' + n).val(),
 rate: $('#Y' + n).val()

);
}} 
var mom = document.getElementById("C'.$i.'").checked = checked; // get a true or false value

Where did $i come from? What value is this meant to retrieve?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.