returnButton
Programmer
Hi, I've been playing around with nodes in JS for the 1st time. I'm getting how to appendChild and insertBefore, it's neat.
What I want to do is insert a DIV into another DIV, so that it wraps around whatever the outer DIV contains.
Hard to explain, here's what I mean:
before:
<div id="a">
div a content
<div id="c">
div c content
</div>
</div>
after (b is inserted):
<div id="a">
<div id="b">
div a content
<div id="c">
div c content
</div>
</div>
</div>
Can this be done? appendChild and insertBefore seem to stick the self-contained DIV either side, but I want it nested.
Thanks all
What I want to do is insert a DIV into another DIV, so that it wraps around whatever the outer DIV contains.
Hard to explain, here's what I mean:
before:
<div id="a">
div a content
<div id="c">
div c content
</div>
</div>
after (b is inserted):
<div id="a">
<div id="b">
div a content
<div id="c">
div c content
</div>
</div>
</div>
Can this be done? appendChild and insertBefore seem to stick the self-contained DIV either side, but I want it nested.
Thanks all