Bug Tracker

Modify

Ticket #5820 (closed bug: invalid)

Opened 3 years ago

Last modified 14 months ago

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:
Blocking: Blocked by:

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

jquery-1.3.2.html Download (436 bytes) - added by jannostern 3 years ago.
works correctly
jquery-1.4.html Download (432 bytes) - added by jannostern 3 years ago.
works incorrectly

Change History

Changed 3 years ago by jannostern

works correctly

Changed 3 years ago by jannostern

works incorrectly

comment:1 Changed 3 years ago by dmethvin

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.

comment:2 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

comment:3 Changed 14 months ago by chris@…

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.