Ask questions and get good answers on jQuery

Hello,

I have a asp.net gridview that is rendered as a HTML table.

The first column is a checkbox and the second is a input box to enter amount.

I would like to taverse through the table and for every checkbox that is checked I would like to sum the corresponding amount entered in the amount textbox.

All help will be highly appreciated.

Regards dm7777

asked May 26 '10 at 20:43

dm7777's gravatar image

dm7777
212

edited Jun 02 '10 at 12:18

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129


Here is the code:

var sum=0;
$("#myTable input:checked").each(function(){
   sum+=parseFloat($(this).next("input").val());
});
alert(sum);

answered Jun 02 '10 at 12:15

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

Your answer
toggle preview

jQuery main site - Matteo Bicocchi