My below code is working fine, but I want to know, is there any short method of doing same work only by JavaScript?
<lable for="fstValue"></lable> First number is: <input type="text" id="fstValue" value="" />
<lable for="sndValue"></lable> Second number is: <input type="text" id="sndValue" value="" />
<hr>
<div id="showResult1"></div>
<div id="showResult2"></div>
<div id="showResult3"></div>
<div id="showResult4"></div>
<button onclick="sandeep()">Check Result</button>
// Get the value, calculate and show the value
function sandeep(){
// Define local function - sandeep varriable
var a, b, resPlus, resMinus, resMultiple, resDivide;
// Get First & Second value
a = parseInt(document.getElementById("fstValue").value);
b = parseInt(document.getElementById("sndValue").value);
// Do calculation
resPlus = a + b;
resMinus = a - b;
resMultiple = a * b;
resDivide = a % b;
// Show result
document.getElementById("showResult1").innerHTML="Plus is " + resPlus;
document.getElementById("showResult2").innerHTML="Minus is " + resMinus;
document.getElementById("showResult3").innerHTML="Multiple is " + resMultiple;
document.getElementById("showResult4").innerHTML="Divide is " + resDivide;
}