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 Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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'>
    <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>
              $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 />';
//Pass the message variable into the answer div.
document.getElementById('answer').innerHTML = msg;
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................