I tried adding two numbers by getting the values from the text box and calculate then display it using innerhtml but it isn't working. What mistake am I doing in this code?
<body onload="alert('Hey check out my Calculator')">
<h1 align="center" > functional calulator </h1>
<div class="Calculator" align="center">
<input type="text" name="text1" id="a1">Enter 1st Number <br><br>
<input type="text" name="text2" id="a2">Enter 2nd Number<br><br>
<button onclick="add()" >Add</button>
<p id="p1"></p>
<script type="text/javascript">
function add(){
var a = document.getElementById("a1").value;
var b = document.getElementByID("a2").value;
var total = a + b;
document.getElementById("p1").innerHTML = total;
}
</script>