Page 1 of 1

jQuery's input macro with checkboxes

Posted: Sun Aug 12, 2007 2:01 pm
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?

Posted: Sun Aug 12, 2007 5:18 pm
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 :)