> Any thoughts on my previous reply?

Leave the markup as-is and replace the Prototype script with this
jQuery. I tried to make the selectors do most of the work, but it
still has the downsides of the original code such as not validating
price inputs.

$(function(){

  var calculate = function() {
    var total = 0;
    $("tr.fieldpair:has(:checked) :text").each(function(){
        total += +this.value;
    });
    $("#total_amount").text(total);
  };
  calculate();
  $("tr.fieldpair :checkbox").click(calculate);
  $("tr.fieldpair :text").keyup(calculate);

});

Reply via email to