jQuery add the value of 2 input text then sum it with total
jquery
Solution
`val` return a string. So you must convert it into a number. You can use `parseInt`.
var sum = parseInt($('input[name=amt_e]').val(), 10);
sum *= parseInt($('input[name=quantity_e]').val(), 10);
$("#total").text(sum);
The names you use in your javascript are not the same in your html. But it's maybe just your example.
Problem
oh god i dont know what to do here please help me... i have this html code ``` <div id="project_math"> <form method="post"> Quantity : <input type="text" name="quatity" value="1" /> Amount : <input type="text" name="amounty" value="20" /> <span id="total">20</span> </form> </div> ``` jQuery ``` $(document).ready(function(){ /* COMPUTATION */ $('input[name=quantity_e]').keyup(function(){ var sum = $('input[name=amt_e]').val(); sum *= $('input[name=quantity_e]').val(); $("#total").text($(this).val()); }); }); ``` what im trying to do is that when i `keyup` and input value like 2 or 10 it will times the value of it to the amount value so if i `keyup` 2 then the amount value is 20 the total should be 40. is my jQuery wrong?