Skip to main content

Bug Tracker

Side navigation

#1095 closed bug (worksforme)

Opened April 03, 2007 05:46PM UTC

Closed December 01, 2009 10:33PM UTC

Hiding/showing div clears radio checks

Reported by: jimzim Owned by: davidserduke
Priority: minor Milestone: 1.2.2
Component: effects Version: 1.1.3
Keywords: radio checked show hide unchecked Cc:
Blocked by: Blocking:
Description

Hi,

I'm running into a problem where hiding/showing a div clears all checked radios within that div.

I reduced the problem code down to the bare minimum to still exhibit the problem. It's attached, or try it out at http://www.thatphonecall.com/jqueryproblem.htm

Is this behavior expected? If so, wouldn't it be more intuitive for show/hide to not clear the checks in radios?

I'm experiencing this problem in IE 6.0.2900.2180...

Thanks,

Jim

Attachments (2)
  • 1095.diff (0.5 KB) - added by davidserduke October 02, 2007 07:56PM UTC.
  • jqueryproblem.htm (0.8 KB) - added by jimzim April 03, 2007 07:38PM UTC.

    this is the correct file to refer to

Change History (12)

Changed April 03, 2007 07:36PM UTC by jimzim comment:1

Whoops. I left a critical line (line 12) commented out in the attachment. Please disregard the first attachment, and refer only to the 2nd one.

Changed April 05, 2007 01:57PM UTC by malsup comment:2

Note that the problem goes away when animation is removed. This works:

$('#hiddenpart').show(); 

Alerting the 'checked' property of the input shows that it changes from 'true' before the animation to 'undefined' afterwards.

Changed July 21, 2007 02:58PM UTC by brandon comment:3

component: interfacefx
description: Hi,\ \ I'm running into a problem where hiding/showing a div clears all checked radios within that div.\ \ I reduced the problem code down to the bare minimum to still exhibit the problem. It's attached, or try it out at http://www.thatphonecall.com/jqueryproblem.htm\ \ Is this behavior expected? If so, wouldn't it be more intuitive for show/hide to not clear the checks in radios?\ \ I'm experiencing this problem in IE 6.0.2900.2180...\ \ Thanks,\ JimHi, \ \ I'm running into a problem where hiding/showing a div clears all checked radios within that div. \ \ I reduced the problem code down to the bare minimum to still exhibit the problem. It's attached, or try it out at http://www.thatphonecall.com/jqueryproblem.htm \ \ Is this behavior expected? If so, wouldn't it be more intuitive for show/hide to not clear the checks in radios? \ \ I'm experiencing this problem in IE 6.0.2900.2180... \ \ Thanks, \ Jim
milestone: 1.1.31.1.4
owner: stefan
priority: majorminor
version: 1.1.21.1.3

Changed October 01, 2007 10:38PM UTC by NatalieMac comment:4

This problem is happening in both IE6 and IE7. It happens when any kind of animation is used to show the container of the radio buttons, but not until the second time the container is shown. Animation to hide the div doesn't affect the checked state of the radio buttons.

Changed October 02, 2007 07:56PM UTC by davidserduke comment:5

The problem here appears to be caused when jQuery.css() clones the node and adds it to the form. The code removes the "checked" attribute, but not the "defaultChecked" one. I guess IE decides to check it when it is appeneded if the defaultChecked is set. Adding a removeAttr("defaultChecked") on all radio buttons seems to work at least for this test case.

I'll attach a patch.

Changed November 05, 2007 05:34PM UTC by saturnflyer comment:6

I have not applied the attached patch, so take this with a grain of salt...

I did a dirty test of this by applying removeAttr("defaultChecked") to input:radio and reset buttons no longer function properly.

Changed November 06, 2007 04:32PM UTC by davidserduke comment:7

Actually if you look closer at the code, the removeAttr("defaultChecked") call is not supposed to be on the actual radio buttons but just on the cloned ones. These cloned ones are just used to get the width/height of the element while it is hidden. So reset will work just fine.

Changed November 15, 2007 01:47PM UTC by brandon comment:8

need: ReviewCommit
owner: → davidserduke

Changed November 15, 2007 01:48PM UTC by brandon comment:9

milestone: 1.1.41.2.2

Changed November 16, 2007 11:41PM UTC by davidserduke comment:10

resolution: → fixed
status: newclosed

Fixed in [3839].

Changed October 09, 2009 01:17PM UTC by pkruithof comment:11

resolution: fixed
status: closedreopened

This bug is active again in version 1.3.2: performing the test case on a default IE7 setup (not the compatibility view in IE8) leaves both radio buttons unchecked.

Changed December 01, 2009 10:33PM UTC by yehuda comment:12

resolution: → worksforme
status: reopenedclosed

Can't reproduce on head. Added a test for animations.