0
how to return number values?
im trying to get number values from input tag but its return string https://code.sololearn.com/Wqp82P034ySM/?ref=app
2 Answers
0
Try this bro:
<script>
function calc()
{
var bil1 =Number( document.getElementById("bil1").value);
var bil2 =Number( document.getElementById("bil2").value);
var result = bil1 + bil2;
document.getElementById("rslt").innerHTML = result;
alert (result);
}
</script>
0
when you enter any value in the input field, a string value is written to your variable. Try function parseInt, to get a number value