I think you want an event handler for the input elements. Maybe something like this? Instead of finding the column in the row above, I just looked for the Nth price in the row above. That turned out to be the most complicated part. The DOM defines a .rowIndex property for TR elements but there is no .colIndex property for TD elements.
$(document).ready(function() { $("input").bind("keyup focus", function(){ var $inp= $(this); var pos = $inp.parent("tr").children().index($inp.parent("td")); $inp.next("span").text( // span following input (+$inp.val() || 0) * // value of input times price in row above $inp.parent("tr").prev().find(".price").eq(pos).text() ); }).trigger("keyup"); }); I probably left a mistake or two in there...