I’m looking to get a bunch of checkboxes (all with the same class) and get all the attribute names and push all the checked boxes into an array (also remove them from the array if they get unchecked).
Eventually, I want to pass an array of what was checked via ajax, and the ajax refreshes every time a box is checked/unchecked.
Any ideas on how I’d do this?
Use
$.mapto get all the names of checkboxes in an array.For second part of your question.
To get only
checkedcheckboxes use$('.theClassName:checked'). You don’t have to maintain an array for this.