I am trying to create a simple point of sale system but i am having a hard time selecting an items, their prices and adding them up in a selected DIV. I am not doing something right, could someone please guide me?
*VIEW CODE:* *<div id="mainContainer"> <div class="inner" id="products"> <span id="forsale">PRODUCTS FOR SALE</span> <hr class="style-head"/> {{for product in products:}} <div class="item"> <a href="#" class="itemProduct">{{=product.product_name}}</a> <span class="divider">|</span> <span>{{=A('Update', _class="update", _id="update", _href=URL('productUpdate', args=product.id <http://product.id>))}}</span></div><!-----------------------------------MAKING A SALE SCRIPT-------------------------------><script type="text/javascript">$(function(){$(".itemProduct").each(function() {$(this).click(function(e) {$("#message").hide();$('#makeSales').html("<table><tr> <td>{{=product.product_name}}</td> <td><input type='text' size='5' placeholder='Quantity' class='num1 key'></td><td><div class='price' id='price'></div></td> <td><div class='sum'></div></td> </tr></table>"); $(".sum").text({{=product.price}}); $("#price").text({{=product.price}}); $(".key").keyup(function() { var $num1 = ($.trim($(".num1").val()) != "" && !isNaN($(".num1").val())) ? parseFloat($(".num1").val()) : 1; var $price=($.trim($("#price").html()) != "" && !isNaN($("#price").html())) ? parseFloat($("#price").html()) : {{=product.price}}; $("#price").text($price); var $totalPrice=parseFloat($num1 * $price); $(".sum").text($totalPrice); });e.preventDefault();});});});</script><div id="makeSales"> <p id="message"> SALES EMPTY! </p> </div>* Regards: Mostwanted -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.