I am trying to move a <div>
that was inserted via a script inside another nested <div>
element (see the example photo). I have tried to use some Javascript and Jquery (e.g. document.getElementById('destination').appendChild(document.getElementById('source'))
), but I have been unable to do it.
I need to move it because I need to position the <div>
in relation to the nested <div>
so that when the nested <div>
gets resized, the other <div>
will move along with it.
Any ideas would be appreciated! I don't have a whole lot of HTML/CSS/Javascript/Jquery experience, but I'm certainly willing to try things to get it to work!
Here's an example of some code. I need to move the <div style id="sp-root-container">
under the <div id="sidebar_div">
. I am also assuming the child elements will follow when they get moved? Please note that I realize the tags are messed up. I couldn't straight up copy and paste it. I think it'll get the point across though!
<body class ="class goes here" >
<div class="container"> </div>
<div class="container-inner"></div>
<div class="column column--sm-3 custom-blocks__right"></div>
<div class="knowledge-base"> </div>
<div class="row clearfix"></div>
<div class="column column--md-3"> </div>
<div id="sidebar_div" class="hp-sidebar"> </div>
<div style id="sp-root-container" class="desktop-version"></div>
</body>