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 at 20:43

dm7777's gravatar image

dm7777
111

edited Jun 02 at 12:18

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1071117


Here is the code:

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

answered Jun 02 at 12:15

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1071117

Your answer
toggle preview

powered by OSQA