Skip to content Skip to sidebar Skip to footer

`attr('checked', False)` Not Working On Ie6

As the title says, I can't get .attr('checked', false) to work on IE6. I am cloning some HTML and then before I assign the newly cloned HTML to a element, I run through it and un-c

Solution 1:

The simplest solution is also an optimisation:

this.checked = false;

In fact, you can apply this optimisation to all of your code:

//get the id attributevar id = this.id;

        //uncheck all of the tick boxesthis.checked = false;

        //get the name attributevar name = this.name;

        this.name = name+"_"+count;
        this.id = id+"_"+count+"_"+i;

This is because the underlying jQuery code accesses these properties anyway (attr mostly works directly with properties until jQuery 1.6).

More info on this at http://whattheheadsaid.com/2010/10/utilizing-the-awesome-power-of-jquery-to-access-properties-of-an-element.

Solution 2:

Solution 3:

There is no HTML attribute 'checked=false', only 'checked=checked' for checked boxes and nothing for unchecked boxes.

use .removeAttr('checked');

Post a Comment for "`attr('checked', False)` Not Working On Ie6"