1 Answer
1

$("select").change(function() {
var qty = $(this).val();
// get the price cell by moving up a level and searching for
// the descendant with a class name beginning with `price'.
// Remove the dollar sign to do math
var price = $(this).closest("tr")
.find("td[class^=price]")
.html().split("$")[1];
// a quantity is a whole number but a price is a float
var total = parseInt(qty) * parseFloat(price);
// write the total for this book to the 'total' cell
$(this).closest("tr")
.find("td[class^=total]")
.html("$" + total);
// sum up all the totals
var grandTotal = 0;
$("td[class^=total]").each(function() {
grandTotal += parseFloat($(this).html().split("$")[1]);
});
// update the grandtotal cell to the new total
$(".grandtotal").html("$" + grandTotal);
});​

In other words, you need to:

1 - Get the quantity from the selected option's value.

2 - Get the price from the cell in the same row whose class begins with 'price', multiply that by the quantity, and update the 'total' cell of the same row.

3 - (Re)calculate the grand total (the sum of all totals) and put that value into the .grandtotal cell.