window.onload = function(){
var textone = document.querySelector('input[name=notationone]');
var texttwo = document.querySelector('input[name=notationtwo]');
var button = document.querySelector('input[name=button]');
var allinputypetext = document.querySelectorAll('input[type=text]');
console.log(allinputypetext);
var spanresult = document.querySelector('.result');
var res;
document.querySelector('input[name=button]').onclick = function(event){
event.preventDefault();
if (textone.value == "" || isNaN(textone.value) || texttwo.value == "" || isNaN(texttwo.value)){
textone.classList.remove("inputone");
texttwo.classList.remove("inputtwo");
textone.classList.add("inputored");
texttwo.classList.add("inputored");
}
else {
calc();
deletenumberinput();
}
return false;
}
function deletenumberinput(){
console.log(allinputypetext[0].value);
for (let i = 0; i < allinputypetext.length; i++)
if (!isNaN(allinputypetext[i].value)) {
allinputypetext[i].value = '';
}
}
function calc(){
var a = parseInt(textone.value);
var b = parseInt(texttwo.value);
var res = a + b;
spanresult.textContent = res;
console.log(res);
}
}