I'm trying to build a calculator using javascript (Trying to advance my skills) and I ran into an issue with trying to add more than one number to the input field(The area where the numbers should show).
$('.Buttons').click(function() {
var getValue = this.value;
if($('#Result').is(':empty')) {
document.getElementById('Result').value = getValue
}
else {
/* document.getElementById('Result').appendChild(document.createTextNode(getValue)); */
resultBox = $("#Result").value + getValue
}
});
Should I use a <div> as the input and simply used the .innerHTML method to change it instead? Sorry if I sound noobish, I just took a javascript test was rated mediocre -_- :( So I'm going to practice Javascript more often now.
resultBox?Number()and notparseFloat(). It will convert blank strings to0(which is better for your calculator)