Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serlialize array

I'm trying to serialise my array but I'm getting nothing in the log.

I want all checkboxes called color[] but not the first one.

I've tried:

$("input[name='color[]:not(:first)']").serialize();

But this logs as blank.

The following works but includes the first one, so it must be a problem with the not part.

 $("input[name='color[]']").serialize();
like image 397
panthro Avatar asked Sep 15 '26 03:09

panthro


2 Answers

Your attribute equal selector is wrong $("input[name='color[]:not(:first)']")

$("input[name='color[]']:not(:first)").serialize();
like image 132
Balachandran Avatar answered Sep 17 '26 17:09

Balachandran


The selector you are using is wrong.

Finish ] after the name=value selector.

$("input[name='color[]']:not(:first)").serialize();

Here are the mistakes highlighted:

$("input[name='color[]:not(:first)']").serialize();
//                    ^     finish selector here
like image 26
Tushar Avatar answered Sep 17 '26 16:09

Tushar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!