2Truth 2Truth - 18 days ago 4
jQuery Question

Changing price based on quantity

I have a dynamic table with products, prices, and quantity. I want to change the price when the quantity is changed. here is my XHTML table

<caption>Checkout Time!</caption>
<td colspan="4" align="right">
<input type="button" value="Checkout!" />
<td class="description">Folger's Gourmet Instant Coffee 24 count box.</td>
<input type="text" id="price" readonly value="12.50" class="readonly" />
<input type="text" id="quantity" value="1" />
<input type="text" id="total" readonly value="12.50" class="readonly" />

I just want to use JQuery. Can someone help?


Try this:

    var tot = $('#price').val() * this.value;

Demo here