Codepedia
.info
Home
About
Demos
Tools
SVG Wave Generator
Colors
Edit This Code :
<html> <head><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> </head> <body> <table id="myTable"> <tr> <th width="100">Name </th> <th>Price</th> </tr> <tr> <td><span>Pen :</span></td> <td><input type="text" class='txtCal' /></td> </tr> <tr> <td><span>Pencil :</span></td> <td><input type="text" class='txtCal' /></td> </tr> <tr> <td><span>Eraser :</span></td> <td><input type="text" class='txtCal' /></td> </tr> <tr> <td><span>Sharpner :</span></td> <td><input type="text" class='txtCal' /></td> </tr> <tr> <td><span>Book :</span></td> <td><input type="text" class='txtCal' /></td> </tr> <tr> <td><span><b>TOTAL :</b></span></td> <td><b><span id="total_sum_value"></span></b></td> </tr> </table> <script> $(document).ready(function(){ $("#myTable").on('input', '.txtCal', function () { var calculated_total_sum = 0; $("#myTable .txtCal").each(function () { var get_textbox_value = $(this).val(); if ($.isNumeric(get_textbox_value)) { calculated_total_sum += parseFloat(get_textbox_value); } }); $("#total_sum_value").html(calculated_total_sum); }); }); </script> </body> </html>
➤ Run / View
Result :