cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
              <link href="https://fonts.googleapis.com/css?family=Karla" rel="stylesheet">

<div class='container'>
  <div class='flex-column'>
    <h1>Multiplier</h1>
    <input type='number' placeholder='What do you want to multiply?' id=input-one></input>
    <input type='number' placeholder='How many times?' id=input-two></input>
      <button type = 'button' id = 'submit'>Submit</button>
         <div id='answer'> </div>
  </div>
</div>
            
          
!
            
              $font: 1.2em 'Karla', sans-serif;
$primary-color: #fff;
$secondary-color: #1e1e1e;


body {
  background-color: #32353a;
  font: $font;
  color: $primary-color;
}

div.container {
  width: 50%;
  height: auto;
  margin: 0 auto;
  background-color: #2c3138;
  border-radius: 5px;
}

div.flex-row {
  display: flex;
  flex-direction: row;
  align-items: center;
}

div.flex-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

input { 
  width: 70%;
  margin: 20px;
  background: none;
  border: 1px solid #4d5663;
  border-radius: 2px;
}

input::placeholder {
  font-size: 60%;
  text-align: left;
  text-indent: 5px;
}

input[type='number'] {
  font: $font;
  color: $primary-color;
  text-align: center;
} 

input:focus {
  outline: none;
}

button#submit {
  width: 40%;
  font: $font;
  color: $primary-color;
  background-color: #6049e5;
  border: none;
  border-radius: 2px;
  margin-top: 20px;
  padding: 10px;
  box-shadow: 0px 0px 45px -10px rgba(96,73,229,0.6);
  cursor: pointer;
  transition: 0.1s linear all;
}

button#submit:hover {
  background-color: #4e3bba;
  box-shadow: none;
}

div#answer {
  background-color: #eaeaea;
  color: $secondary-color;
  width: 100%;
  margin-top: 20px;
  text-align: center;
  padding: 10px 0 10px 0;
}
            
          
!
            
              //Add listener for submit click.
document.getElementById('submit').addEventListener('click', function(){

//Set i to 1.
var i = 1;
//Set msg to an empty string to be filled by the function.
var msg = '';
//Retrieve values of both inputs in string data.
var inputOne = document.getElementById('input-one').value;
var inputTwo = document.getElementById('input-two').value;

//ParseFloat the previous variables to retrieve number data.
var inputOneParsed = parseFloat(inputOne);
var inputTwoParsed = parseFloat(inputTwo);

//Loop through the inputted numbers  
while (i <= inputTwoParsed) {
//If i is less than or equal to the second input, run code.
  msg += inputOne + 'x' + i + '=' + (i * inputOneParsed) + '</br />';
  i++;
}
//Pass the message variable into the answer div.
document.getElementById('answer').innerHTML = msg;
});
            
          
!
999px
Loading ..................

Console