I wanna move an html elements from one node to another but I didn't know how, when I thought about it at first It seems easy but in practice it's a little bit hard I'm still thinking it's silly though.
here is an example:
<div class="container">
<h1>text</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="con">
</div>
<button> click ME </button>
I wanna move what is inside the .container
div
to the .co
div
I have searched a lot on google but I didn't find anything useful, I have searched even here on stackoverflow but I did find a solution.
any help please and thank you in advance
questions I have saw and didn't solve the problem:
Moving HTML element from one page to another
"Cut and Paste" - moving nodes in the DOM with Javascript
How to move all HTML element children to another parent using JavaScript?