Jquery html() and self closing tags

Posted by Pedro Reis on Stack Overflow See other posts from Stack Overflow or by Pedro Reis
Published on 2010-03-31T23:55:57Z Indexed on 2010/04/01 0:03 UTC
Read the original article Hit count: 199

Filed under:
|
|
|
|

While creating self contained elements with Jquery html() the following issue happens:

$('#someId').html('<li><input type="checkbox" /></li>')

will create

<li><input type="checkbox"></li>

It closes correctly the <li> tag but not the <input>

It seems its an issue from innerHtml which is used in the html() function.

I have looked everywhere and found a solution for this but the page is not available anymore as you see in: http://dev.jquery.it/ticket/3378

Anybody knows how to fix this?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about innerhtml