Multiply variables with jquery -
i want multiply fields order['count'] , product.price
{% product in product %} <td class = "price">{{ product.price }}</td> <td> <input class="count form-control" style="width: 40%" type="text" {% order in basket %} {% if order['id'] == product.id %} value="{{ order['count'] }}" {% endif %} {% endfor %} /> </td> {% endfor %} how can jquery?
my html
<div> <table> <thead> <tr> <th>price</th> <th>count</th> </tr> </thead> <tbody> <tr> <td>12</td> <td><input value="2 /></td> </tr> </tbody> </table> </div>
i'm going go off of assumption want every 1 of them. can filter down if not want. going without event if want happen on event you'll have derive bindings.
$(document).ready(function(){ $('.price').each(function(){ var $price = $(this); var $count = $price.parent().find('.count'); console.log( +($price.html()) * +($count.val()) ); }); });
Comments
Post a Comment