ID elements on a page have to be unique. As you're looping over a query, I'm guessing you're ending up with multiple checkboxes, all of them with ID=category. So document.getElementById("category") doesn't know which checkbox you're interested in (getElementById only returns 1 element). You might want to look at either something like jQuery's.each(), or simply document.getElementsByClassName
↧