0

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

2
  • Try using the .attr() and set the checked attribute explicitly, you don't really need the escape sequences there Commented Oct 3, 2012 at 6:58
  • Could be related to this jquery bug report: bugs.jquery.com/ticket/12127 Commented Oct 3, 2012 at 7:05

1 Answer 1

1

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??

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.