I want to remove an element from it's parent and append it to other element. From the start, the code looks like below:
<div id="example">
<div class="photobooth">
<ul id="capture_options">
<li>Cpture 1</li>
<li>Capture 2</li>
</ul>
</div>
</div>
<div id="option_div">
</div>
I want to remove capture_options and append it to a div with an id "option_div". Any idea on how to do that?
Using jQuery, you can do as simple as this:
$(function(){
$('#capture_options').appendTo( $('#option_div') );
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="example">
<div class="photobooth">
<ul id="capture_options">test</ul>
</div>
</div>
<div id="option_div">
</div>