jquery .html() vs div creation

Posted by Argiropoulos Stavros on Stack Overflow See other posts from Stack Overflow or by Argiropoulos Stavros
Published on 2010-06-10T14:29:04Z Indexed on 2010/06/10 14:32 UTC
Read the original article Hit count: 284

Filed under:
|

Hello

Lets say i have a div

<div id='myDiv'></div>

If i do: $('#myDiv').html('<div id='mySecondDiv'></div>') is it the same as

var mySecondDiv=$('<div></div>');
$('myDiv').add(mySecondDiv);

I'm pretty sure i have syntax errors but you get the idea.Are the two methods same?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html