JSFiddle - React, Tailwind, and code Playground
HTML
<script>
function f2(){
var a= +document.getElementById("a").value;
var b= +document.getElementById("b").value;
if(!isNaN(a) && !isNaN(b)){
document.write(a+b);
}else{
document.write("enter numbers");
}
}
</script>
Enter A:<input id="a" type="text" name="txt1" ><br>
Enter B:<input id="b" type="text" name="txt2" ><br>
<button type="button" onclick="f2()">Sum Here</button>