I have the following structure:
var $html = $("<div id='a'><div id='b'><div id='c'></div></div></div>");
I want to insert the following into the $html structure under div #c:
var html = "<div id='d'><div id='e'><div id='f'></div></div></div>";
I tried the following:
var $newHtml = $($html).find("#c").append(html);
I thought now the variable $newHtml would point to div #a and all its descending elements including the newly appended ones.
However, $newHtml only contains the #c div and decendants.
How do I get the #a object and its descendents?
Update:
To clarify:
I have the jquery object $html and a string html.
I want to insert the html string into one the innermost element of the $html structure.
both append & html works for it. The problem is, $newHtml only holds the elements of #c. $html contains all, including inserted elements.
var $html = $('<div id="a"><div id="b"><div id="c"></div></div></div>');