NaN
NaN

Reputation: 1306

How do I get a checkbox value

I'm sure this has been asked many times before but I'm not sure what will work for me. I'm pretty JQ illiterate but working on it.

I need to get the checkbox values so that I can process them on the server. Currently, I get a POST value for checked but nothing for unchecked. Can someone please show me how to get the unchecked value?

$(this).next()[0].checked = !$(this).next()[0].checked;
var vals = $(this).next().serializeArray();

Upvotes: 0

Views: 1036

Answers (1)

Jason
Jason

Reputation: 52523

var val = $(this).is(':checked');

Here's a demo fiddle proving it works

Upvotes: 1

Related Questions