Created
November 21, 2012 12:18
-
-
Save L422Y/4124585 to your computer and use it in GitHub Desktop.
A CodePen by Larry Williamson.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<span class="span1"> | |
<img src="http://blog.codepen.io/wp-content/uploads/2012/06/Button-Black-Small.png" width=20 id="galaxy" /> | |
</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" id="btnid">+</i></a> | |
</div> | |
<hr> | |
Cart: | |
<div class="span7" style="border:1px black" id="separat"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function AddToCart() { | |
var img = $(this).closest('div').find('img').first(); | |
var image_id = $(img).attr('id'); | |
var newobj = $('<div>'); | |
newobj.prepend(img.clone()); | |
newobj.append('<span>' + image_id + '<span>'); | |
$('#separat').append(newobj); | |
} | |
$(function(){ | |
$('.icon-plus').click(AddToCart); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.pull-right i { | |
padding:2px; | |
background:orange; | |
color: black; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment