Sridhar Narasimhan
Sridhar Narasimhan

Reputation: 2653

Checked attribute in checkbox IE

While appending input element with checked attribut as below code

$("#addcheckbox").append("<input type='checkbox' value=\"Hi\" checked='checked'>"); // addcheckbox is div 

In IE the rendered element looks like

<input type="checkbox" CHECKED="" value="Hi"/>

This occurs after using jquery 1.7.2 before that it was like below

<input type="checkbox" CHECKED="checked" value="Hi"/>

because of this, i am facing lot if issues with jquery templating.

any help

Thanks

Upvotes: 0

Views: 764

Answers (1)

Sushanth --
Sushanth --

Reputation: 55750

Maybe because you were not closing the input properly.. Close the tag and try again..

$("#addcheckbox").append("<input type='checkbox' value='Hi' checked='checked' />");

OR

$('<input/>', {  
    type: 'checkbox',  
    value: 'Hi',  
    checked: 'checked'  
}).appendTo('#addCheckBox') ;

Also What is #addCheckBox Here.. Is it a Div??

Upvotes: 1

Related Questions