I am new to jQuery. I have 2 panels: if I click on the image in the left panel, this image will appear in the right panel. I do this with clone () while I'm here. Now I would like the image in the right pane to be deleted when I click on it. And the calculation of the total weight (from img id) will depend on whether I add or remove images from the right panel. Can someone please help me.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>test</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="script/jquery-1.7.2.min.js"></script> <style type="text/css"> #output, #selectList { width: 202px; border: 1px solid #000; margin: 2px; height: 400px; float: left } </style> </head> <body> summary weight: <div id="sumcount"></div>kg<br /> <div id="selectList"> <img id="34" src="http://placekitten.com/80/80" /> <img id="21" src="http://placekitten.com/81/81" /> <img id="11" src="http://placekitten.com/g/80/80" /> <img id="5" src="http://placekitten.com/g/81/81" /> <img id="9" src="http://placekitten.com/g/82/82" /> </div> <div id="output"> </div> <script type="text/javascript"> $(function(){ var output = $('#output'); </script> </body> </html>
Demo: http://jsfiddle.net/XLSmU/
source share