Hallo,
I would appreciate your advice. Given the following snippet:
<div id="parent"><div id="child">ChildText<span id="subchildtext"><b>SubChildText</b></span></div></div>
I want to:
Extract the span Element
==>var span = $("#child").find("span");
Prepend some Text ("foobar") and a new HTML element ("
<b>
foorbarbold</b>
)
==>span.insertBefore("foobar<b>foobarbold</b>")
Insert that new Element "into" the Parent (ID=PArent element)
==>$("#parent").html(span);
The result should be: <div id="parent">foobar<b>foobarbold</b><span id="subchildtext"><b>SubChildText</b></span></div>
But that doesnt work. I am not able to insert the new content to the extracted element. How could I accomplish this?
Thank you very much! Tim