A simple addition calculator was made on the page to achieve real-time calculation of the input values:
<!DOCTYPE HTML><HTML><Head><Scripttype= "Text/javascript"src= "Jquery-3.2.1.js"></Script><Scripttype= "Text/javascript">$ (document). Ready (function(){ //to define a common aggregate function functionCompute (arrname,resultname) {varresult= 0 ; for(varI= 0; I<arrname.length; I++) {result+=Number ($ ('input[name='+Arrname[i]+']'). Val ()); } $('input[name='+Resultname+']'). val (result); } //Define input varArrname= ['NUM1','num2']; //Store Calculation Results varResultname= 'result'; //bind compute to the blur event for each input box for(varI= 0; I<arrname.length; I++){ $("input[name="+Arrname[i]+"]"). On ('KeyDown', {arrname:arrname,resultname:resultname},function(e) {compute (arrname,resultname); //Debugger; }); } } );</Script></Head><Body> <Center> <inputtype= "text"name= "NUM1"value= " the"style= ' width:34px;height:34px '/> + <inputtype= "text"name= "Num2"value= "6"style= ' width:34px;height:34px '/> =<inputtype= "text"name= "Result"value=""ReadOnly= "true"style= ' background-color:lightgray;width:34px;height:34px '/> </Center></Body></HTML>
JS's Simple addition calculator