Reputation: 11
how can i push all checked checkboxes to array
Upvotes: 0
Views: 69
Reputation: 124
I suppose what you want is add an event listener to your new checkbox.
After cell.appendChild(element1);
, you can add an event listener as follow:
element1.addEventListner('click', () => {
toggleThisNumber(0);
// your other codes here
});
Upvotes: 0
Reputation: 165
You can pass function reference to html and track it.
<input type="checkbox" onchange="handleChange(event)">
JS:
function handleChange(e) {
const {checked} = e.target;
}
Upvotes: 1