# Pure JavaScript Simple Calculator Tutorial

## Pure JavaScript Simple Calculator Tutorial

In this tutorial we are going to learn pure  JavaScript simple Calculator Application through input text box, complete code is given below and code is easy to understand, still, if you find any kind of difficulty then please comment, I will try to clear you …

## JavaScript Simple Calculator Complete Code :

```
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title>JavaScript Calculator</title>
<body>
<input type="text" id="num1" placeholder="Enter Number">
<input type="text" id="num2" placeholder="Enter Number">
<select id="sel">
<option value="">Select</option>
<option value="division">division</option>
<option value="substract">substract</option>
<option value="multiply">multiply</option>
</select>
<input type="submit" onclick="addition()" value="submit">
<br/>
<div id="result"></div>
<script>
var num1= parseFloat(document.getElementById("num1").value);
var num2= parseFloat(document.getElementById("num2").value);
var sel=document.getElementById("sel").value;
var result;
result=num1+num2;
}else if(sel=='substract'){
result=num1-num2;
}else if(sel=='division'){
result=num1/num2;
}else{
result=num1*num2;
}
document.getElementById("result").innerHTML=result;
}
</script>
</body>
</html>

```

## JavaScript Simple Calculator Demo :

5 1 vote
Article Rating
Subscribe
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.