Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <title>JavaScript Calculator 1</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!--Need this for icons-->
<link rel="stylesheet" href="">
  <!--fonts used-->
<link href="" rel="stylesheet"
	<link href=' Expanded' rel='stylesheet'

<!--Have to insert CSS code here for browers, java script below body-->


<div class = "container">
      <!--<input type="dummy"  /> -->
   <h2> MDD Electronics, Inc.<br>
    Basic Digital Calculator</h2>
   <div id = "answer">
  <!-- <p id = "display">0</p>-->                  <!--this needs to be used for totholding num on screen-->
	 <h6> ZLD23001</h6>
	  <hr size="6" color="black">
  <div id="keyboard"</div>      
  <!--Row 1-->                                                       
  <button class="operator" id="clear">C</button>
  <button class="operator" id="lParen">( </button> 
  <button class ="operator" id ="rParen">)</button>  
  <button class = "operator" id="divide">&divide</button>
    <!--end row 1-->
   <!--Row 2-->
 <button  class = "number" id = "seven">7</button> 
 <button  class = "number" id = "eight">8</button>
 <button  class  = "number" id = "nine">9</button>
 <button  class = "operator" id = "x">x</button>
    <!--end row 2-->
  <!--row 3-->
  <button  class = "number" id = "four">4</button> 
  <button  class = "number" id = "five">5</button>
  <button  class = "number" id = "six">6</button>
  <button  class = "operator" id = "minus">-</button>
  <!--end row 3-->
  <!--row 4-->
  <button  class = "number" id = "one">1</button> 
  <button  class = "number" id = "two">2</button>
  <button  class = "number" id = "three">3</button>
  <button class = "operator" id = "plus">+</button>
  <!--end row 4-->
  <!--row 5-->
   <button class = "operator" id = "back">&#8630</button> 
   <button class = "number" id = "zero">0</button>
   <button class = "operator" id = "decimal">.</button>
   <button class = "operator" id = "equal">=</button>
   <!--end row 5-->
   </div> <br><br><!--close keyboard-->
  <footer>Coded by Jane Schad
          Rights Reserved 9/2017
</div> <!--close container-->


                body {
    font-family: Comic Sans MS, cursive, sans-serif;
.container {
  background-color:#b3b3b3;   /*color of calculator body shde of greyish*/*/
  border-radius: 10px; 
  box-shadow: 3px 3px 15px black, 1px 1px 3px white inset; 
  padding: 20px;
  margin: 0 auto;  
  margin-top: 30px; 
  width: 300px; 
  height: 430px; 

font-size: 1.0em;
text-align: center;

font-size: 0.50em;
text-align: right;
padding-right: 10px;

  text-align: center;
  font-size: .7em;
  margin-bottom: 10px;

#answer {
  background-color: #D2E4E2;   /*ok light blueish*/
  font-size: 1.50em;           /*ok this is size of input on screen*/
  height: 55px;
  width: 90%;
  display: block; 
  border-width: 8px 12px 8px 12px; 
  border-color: #828284;                /*ok medium greyish*/
  border-style: solid; 
  border-radius: 2 350 
  margin: 0 auto; 
  overflow: hidden; 
  padding-right: 5px;  
  position: relative; 
  text-align: right; 

  display: inline-block;
  background-color: #dbc3a3;        /*ok keys* tan*/
  color: black;                    /*ok keyboard nums*/
  box-shadow: 1px 2px 1px; 
  margin: 3px; 
  font-weight: bold;
  height: 40px; 
  width: 50.5px; 
  float: center;                     /*ok*/

#keyboard {  
  margin: 0 auto; 
  margin-top: 10px;
  height: 200px; 
  width: 94.5%; 

button:hover {
  border: 1.50px solid #09abf6; 



                $(document).ready(function() {
  var answer = "";
  var totalInput = "";
  var lpare = false;
   var rpare = false;
  var deci = false;
  var operator = false;
  totalInput = $("#answer");

  $("#clear").on("click", function() {
    answer = "";
    dec = false;

  $("#back").on("click", function() {
    answer = answer.slice(0, -1);

  $("#decimal").on("click", function() {
    if (deci !== true) {
      answer += ".";
      deci = true;
  $("#lParen").on("click", function (){
  if (lpare === false) {
      answer += $(this).text();            totalInput.text(answer);
  $("#rParen").on("click", function (){
  if (rpare === false) {
      answer += $(this).text();            totalInput.text(answer);
  $("#divide, #x, #plus, #minus").on("click", function() {
    if(operator === false){
    answer += $(this).text();
    if ($(this).attr("id") === "divide" || $(this).attr("id") === "x" ||
 $(this).attr("id") === "plus" || $(this).attr("id") === "minus" ) {
      deci = false;
     operator = true;
  $("#zero, #one, #two, #three, #four, #five, #six, #seven, #eight, #nine").on("click", function() {
    if (answer.length < 21) {
      answer += $(this).text();
      operator = false;

  $("#equal").click(function() {
    answer = answer.replace(/x/g, "*").replace(/÷/g, "/");
    answer = eval(answer);