jquery - JavaScript Calculate total price of items -
please me type total price of selected items. here jsfiddle <section id="items"> <div class="item">monitor <span class="price">100$</span></div> <div class="item">mouse <span class="price">20$</span></div> <div class="item">keyboard <span class="price">60$</span></div> </section> <section id="basket"> <p>total price:<span class="total_price"></span></p> </section>` check demo var total = 0; $("#items").on('click', ".item", function() { $(this).appendto("#basket"); gettotal() }); $("#basket").on('click', ".item", function() { $(this).appendto("#items"); gettotal() }); function gettotal(){ total = 0; ...