Hi all iam working on jquery here i have a html page. in the html i have two div’s in those firstdiv contains
image, name, and price right now we have to move(add) image to another div which is empty div here i had done to (move) add
image form first to secound but problem is when image added to the secound div the images should be appear in the
same place in first div and also in the secound div i had done to image add to secound div but images removes from the first div
this is my code follows:
<div>
<span class="span1">
<img src="~/Images/galaxy.jpeg" /></span>
<span class="span1">1232</span>
<span class="span2">Cell Phone</span>
<span class="span1">3500</span>
<a href="#" class="pull-right" ><i class="icon-plus" onclick="AddToCart(this)" id="btnid" ></i></a>
</div>
<div class="span7" style="border:1px black" id="separat">
</div>
in the above code iam having ‘icon-plus’ button when i click the button it adding image to the secound div but i need
images should add and it shoul appear in the same place also
and this is my jquery
$(function () {
AddToCart(this);
});
function AddToCart(obj) {
var val = 0;
var $this = $(obj).closest('div');
var img = $this.find('img');
var image=img;
$('#separat').append(img);
}
Could anybody please help me to do this?
you sholud use
clone()http://api.jquery.com/clone/
UPDATE
if you want to get the prize and name