0

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();
NaN
  • 1,286
  • 2
  • 16
  • 29

1 Answers1

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

Here's a demo fiddle proving it works

Jason
  • 51,583
  • 38
  • 133
  • 185
  • 2
    despite the downvote, this is how you get the value of a checkbox. see fiddle – Jason Jan 08 '13 at 19:42
  • Why were you downvoted? Granted, I know diddly about JQuery but this doesn't look like a bad answer to me. – NaN Jan 08 '13 at 19:43
  • Well, I just upvoted you and I'm selecting this as the right answer. Thank you for your help! – NaN Jan 08 '13 at 19:46