I think you can let the selector do all the work: var sum = 0; $(".fieldpair > :checked + :text").each(function(){ sum += +this.value; });
It's rare I ever find a use for the sibling selector!
I think you can let the selector do all the work: var sum = 0; $(".fieldpair > :checked + :text").each(function(){ sum += +this.value; });
It's rare I ever find a use for the sibling selector!