I want the user to insert a number e.g. 10 and make the calculation var newbalance + balance + 2, but the output of this code would be 102 and not 12. I think my script thinks the var balance is not an integer but a word or something. how can I fix this
<form id="form" oninput="checkChange()" onchange="checkChange()">
<div class="container100 t-center" style="font-size:0;">
<div class="container20 t-center">
</div>
<div class="container60 t-center">
<div class="container60 t-center" style="font-size:0;">
<div class="container60 t-center">
Balance
<input name="balance" type="text" style="width:90%;" placeholder='balance'>
<input type="text" id="mytext">
</div>
</div><br><br>
</div>
<div class="container20 t-center">
</div>
</div>
</form><br>
<button id="submit" class="button" onclick="command()">Submit</button><br><br>
<script>
document.getElementById('submit').onclick = command;
var submitButton = document.getElementById('submit');
submitButton.onclick = command;
function command() {
event.preventDefault();
submitButton.style.background = 'rgba(92,184,92,1)';
}
function checkChange(){
submitButton.style.background = 'rgba(90,90,90,1.0)';
}
function command(){
var x = document.getElementById("form");
var balance = x.elements["balance"].value;
var newbalance = balance + 2;
document.getElementById("mytext").value = newbalance;
}
</script>