Hangfire 4 Junior Poster in Training

Hi guys
I'm making a golf handicap calculator, you have a couple of columns, for each hole - par, score, difference and adjusted difference.

I need to total up each column, and this is my code to do it.
It works but feels inefficient and clunky.
Any thoughts on improving it? In particular can you sum up a bunch of inputboxes with the same class instead of using the each loop?

function calcTotals()
{
	var tpar = 0;
	var tscore = 0;
	$("#scorecard .par").each(function(){
		if(isNumber($(this).val()))
		{
			tpar += parseInt($(this).val());
		}
		if(isNumber($(this).parent("td").next("td").find("input").val()))
		{
			tscore += parseInt($(this).parent("td").next("td").find("input").val());
		}
	});
	$("#totPar").html(parseInt(tpar));
	$("#totScore").html(parseInt(tscore));
}

function isNumber(n) { 
  return !isNaN(parseFloat(n)) && isFinite(n); 
}

cheers and beers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.