I am making a program to add 10% in a value entered by user with java script.
my HTML code
<input id='new' onKeyUp='doit()' name='hello' onkeydown='doit()' value='' placeholder='Type a numeric value' />
<input id='new1' value='' placeholder='final value' />
my java script code
<script>
function doit()
{
var sum=document.getElementById('new').value;
var extra=sum/10;
var newamount=sum + extra;
document.getElementById('new1').value=newamount;
}
</script>
on giving input 100 expected output is 110 but actual output comming is 10010
Although i am adding according to rule.... w3schools example
Please tell me where i am wrong.......................
var sum=+document.getElementById('new').value;