My objective is to transfer li elements from one container to another container when the user clicks on the li span. I have a choices container and a choices display, so when a user clicks on the li span with the id of "add" in the first container, the respective li element is removed and should appear in the second container. However, I am facing some challenges in moving only the selected li element and I am unsure about handling callbacks in this scenario. Any advice on this matter would be greatly appreciated.
<script>
(function($){
jQuery( "#catalog" ).accordion({
heightStyle: "content"
});
jQuery("span#add").click(function(){
jQuery(this).parent().animate(
{
'margin-left':'1000px'
},1000,
function(){
var ul_class = $(this).parent().attr('class');
$(this).slideUp('fast');
$("ul."+ ul_class + "_clone").append($(this).parent().html());
$(this).remove();
}
);
});
}) (jQuery);
</script>
<?php $datas = json_decode($param[0]->params) ?>
<div class="config_holder">
<div id="products">
<h3>Config Params</h3>
<div id="catalog">
<?php foreach ($datas as $key1=>$data):?>
<h4><a href="#"><?php if(!empty($key1)) echo $key1 ?></a></h4>
<div>
<ul class="<?php echo $key1 ?>">
<?php if(!empty($data) ):?>
<?php foreach($data as $key2=>$item):?>
<?php if($key2 !=" " || $key2 != " "): ?>
<li id="" class="ui-state-default ui-corner-all" ><?php echo $key2; ?><span style="float:right" id="add" class="ui-icon ui-icon-circle-plus"></span></li>
<?php endif;?>
<?php endforeach; ?>
<?php endif;?>
</ul>
</div>
<?php endforeach;?>
</div>
</div>
<div id="cart">
<h3 >Mein Konfiguration</h3>
<div class="ui-widget-content">
<img title="" src="http://i.dell.com/das/dih.ashx/165x130/sites/imagecontent/consumer/merchandizing/de/PublishingImages/165x119/6315-inspiron-17r-5721-165X119-de.png" alt="">
<ol>
<li class="placeholder">My Choises</li>
<?php foreach ($datas as $key3=>$clone):?>
<ul class="<?php echo $key3 ?>_clone"></ul>
<?php endforeach;?>
</ol>
</div>
<a href=""><button>search</button></a>
</div>
</div>