Moving checkboxes through document

Atom RSS

This site heavily relies on bug reports created by its readers. Anyone can report a bug and be published.

Main navigation:




Search reports by browser:

If you move a checkbox through the document by W3C DOM methods, the checkbox returns to its default state (checked or unchecked).

Test page. Workaround is included.
Reported by ppk.

Explorer 5-6 Windows, Explorer 7 beta 2 | Reported on 29 October 2004.

Comments

(Add your own)

Posted by Huberto Kusters on 24 November 2004

1

IE Windows uses the property 'defaultChecked' as its initial value.
So my guess is to have the 'onchange' event set this property equal to the 'checked' property, like this:

function checkIt(oInput) {
    if (typeof oInput.defaultChecked != 'undefined') {
        oInput.defaultChecked = oInput.checked;
    }
    return true;
}
...

<input type="checkbox" onchange="checkIt(this);">

Posted by Kae on 2 December 2004

2

This bug seems to also apply when checkboxes are created dynamically.

This script, for example, creates checkboxes dynamically. If the initial state of these must be "checked", then Buberto's workaround must be used.
http://verens.com/archives/2004/09/03/multiselect/

Posted by Tony on 13 July 2005

3

Radio buttons also seem to be affected by this bug.

Posted by Graham Lea on 9 February 2006

4

This problem also occurs when cloning checkboxed.

Post a comment

Commenting guidelines:

  1. When quoting specs, articles or your own research, please include a URL of the document.
  2. Test your stuff. When reporting browser behaviour, make sure that your report is correct.

Yes