Bug Tracker

Opened 14 years ago

Closed 14 years ago

#4523 closed bug (invalid)

:input selector doesn't work for checkboxes

Reported by: allspiritseve Owned by:
Priority: minor Milestone: 1.3.2
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:


I'm submitting a form through ajax, using :input to grab all the form values. However, it is not distinguishing whether checkboxes have been checked or not... it just grabs the value anyways.

Change History (2)

comment:1 Changed 14 years ago by allspiritseve

Here's what I'm using, if that helps at all:

$(document).ready(function() {

$('#addtocart').click (function() {

$.ajax ({

type: "POST", url: 'includes/ajaxcart.php', dataType: 'json', data: $(':input'), success: function (result) {

$('#bagcount').text (result.count); alert (result.message);


}); return false;



comment:2 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

The value property of a checkbox (which you are getting indirectly) is the same whether its checked attribute/property is set or not.

If you want the values of all the form elements as they would have been if you submitted the form, look at the formSerialize method in the Forms plugin.

Note: See TracTickets for help on using tickets.