jQuery's input macro with checkboxes

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

jQuery's input macro with checkboxes

Post by GeXus »

I'm using the input macro, like this

Code: Select all

var inputs = [];
          $(':input', this).each(function() {
            inputs.push(this.name + '=' + escape(this.value));
          })

But i'm having problems with it getting the correct value for checkboxes... If i have the value as 1 for a checkbox... it still gets passed as 1 even if it is not checked, as though it doesnt check the state of the checkbox, but only the value... which would mean that all checkboxes get passed...

Any ideas if there is a work around?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

I am not familiar with jQuery, but there must be some kind of this.checked property. Then a simple if statement would do the job :)
There are 10 types of people in this world, those who understand binary and those who don't
Post Reply