Skip to main content

Bug Tracker

Side navigation

#5820 closed bug (invalid)

Opened January 15, 2010 12:22PM UTC

Closed January 15, 2010 05:44PM UTC

Last modified March 15, 2012 11:30AM UTC

the val() method returns checkbox value incorrectly

Reported by: jannostern Owned by:
Priority: major Milestone: 1.4.1
Component: unfiled Version: 1.4
Keywords: Cc:
Blocked by: Blocking:
Description

Starting from the version 1.4 jQuery always seems to return the value of checkboxes "on", with the val() method. It does not matter, if the checkbox is checked or not.

Noticed it on Chromium daily build on linux, but it seems to act like this, also with the Firefox 3.5.5.

jQuery 1.3.2 seems to work fine.

See the attachment.

Attachments (2)
  • jquery-1.3.2.html (0.4 KB) - added by jannostern January 15, 2010 12:23PM UTC.

    works correctly

  • jquery-1.4.html (0.4 KB) - added by jannostern January 15, 2010 12:23PM UTC.

    works incorrectly

Change History (3)

Changed January 15, 2010 02:04PM UTC by dmethvin comment:1

Didn't you forget a

value
attribute? If you just wanted to know if the box was checked, you should use
:checked
or look at the
.checked
property.

Changed January 15, 2010 05:44PM UTC by dmethvin comment:2

resolution: → invalid
status: newclosed

Changed March 15, 2012 11:30AM UTC by chris@tweega.com comment:3

I don't see what is invalid about the original complaint. The point of val() (to me) is that I can get an input value without checking the control type. Now I have to.