JSFiddle - React, Tailwind, and code Playground

by Nidhi Patel

HTML

Number1: <input type = "text" value="" id = "Num1"/> <br> <br>
Number2: <input type = "text" value="" id = "Num2"/> <br> <br>
<input type = "box" id = "save" value="" disabled="true"/>
<input type = "submit" value = "+" id = "sum" />
<input type = "button" value = "*" id = "multiply"/>
<input type = "button" value = "%" id = "modulo"/>

JavaScript

sum.onclick = function(){

	var a = parseInt(document.getElementById("Num1").value);
  var b = parseInt(document.getElementById("Num2").value);
 
  document.getElementById("save").value=sum1(a,b);
}
function sum1(a,b){
            return a+b;
        }
multiply.onclick = function(){

	var a = parseInt(document.getElementById("Num1").value);
  var b = parseInt(document.getElementById("Num2").value);
 
  document.getElementById("save").value=multiply1(a,b);
}
modulo.onclick = function(){

	var a = parseInt(document.getElementById("Num1").value);
  var b = parseInt(document.getElementById("Num2").value);
 
  document.getElementById("save").value=modulo1(a,b);
}


        function multiply1(a,b){
            return a*b;
        }
        function modulo1(a,b){
            return a%b;
        }