jquery - Auto sum for horizontal numeric boxes not working -


i trying use auto sum functionality 3 horizontal boxes, neither auto sum working , not sure has gone wrong readonly property also, not working me.

below code.

<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){     $("#t3").prop('readonly',true);     var sum=0;     for(var i=1;i<=2;i++)     {         $("#t"+i).keyup(function(){             sum=sum+parseint(this.val());         });     }     $("#t3").val(sum); }); </script> </head> <body> <table>     <tr>         <td id="t1"><input type="text"></td>         <td id="t2"><input type="text"></td>         <td id="t3"><input type="text"></td>     </tr> </table> </body> </html>  

bind event on input's not on td's:

<script> $(document).ready(function(){     $("#t3  input").prop('readonly',true);     var sum=0;     for(var i=1;i<=2;i++)     {         $("#t"+i + " input").keyup(function(){             sum=sum+parseint(this.val());         });     }     $("#t3 input").val(sum); }); </script> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -