I need to change the inputs
fields of a GridView
, and as they are changed I must display the sum of these inputs
fields in another input
that is in the footer of the screen and the question is: how to get the value of these input fields through JQuery
?
GridView
and I do not know how to get ID
or NAME
from input
since they are dynamically created / p>
<table id="gridModal">
<tbody>
<tr>
<td>Abril/2016</td>
<td>6</td>
<td>11,61</td>
<td>
<input id="gridModal_txtQtdNovo_0" type="text" value="11,61" name="gridModal$ctl02$txtQtdNovo">
</td>
<td>6</td>
</tr>
<tr>
<td>Maio/2016</td>
<td>23</td>
<td>44,52</td>
<td>
<input id="gridModal_txtQtdNovo_1" type="text" value="44,52" name="gridModal$ctl03$txtQtdNovo">
</td>
<td>21</td>
</tr>
<tr>
<td>Junho/2016</td>
<td>22</td>
<td>42,58</td>
<td>
<input id="gridModal_txtQtdNovo_2" type="text" value="42,58" name="gridModal$ctl04$txtQtdNovo">
</td>
<td>20</td>
</tr>
<tr>
<td>Julho/2016</td>
<td>21</td>
<td>40,65</td>
<td>
<input id="gridModal_txtQtdNovo_3" type="text" value="40,65" name="gridModal$ctl05$txtQtdNovo">
</td>
<td>19</td>
</tr>
<tr>
<td>Agosto/2016</td>
<td>23</td>
<td>44,52</td>
<td>
<input id="gridModal_txtQtdNovo_4" type="text" value="44,52" name="gridModal$ctl06$txtQtdNovo">
</td>
<td>21</td>
</tr>
</tbody>
</table>
This was the suggestion of DanielDutra
, according to the suggestion in the comment below and met my needs, however the summation only calculates the whole part neglecting the fractioned part:
<script type="text/javascript">
$(document).ready(function () {
var _valor = 0;
$("table#gridModal input").on('change', function () {
_valor += parseFloat($(this).val());
});
});
</script>