Im trying to get all checked boxes with a name if images[].
I would usually
imgs = $('input:checkbox[name=images]:checked').map(function() { return this.value; }).get();
The below code is what I have tried and isnt working.
imgs = $('input:checkbox[name=images[]]:checked').map(function() { return this.value; }).get();
You should escape the brackets (adding quotes would also avoid the problem, but escaping special characters is still good practice):
imgs = $('input[type="checkbox"][name="images\\[\\]"]:checked').map(function() { return this.value; }).get();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With