Pen Settings

HTML

CSS

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

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

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.

HTML

              
                <div class="entries">
  
  <div class='wrap wrapOne'>
    <label for="subject">Subject</label>
    <input type="text" id="subTxt" class='input' />
       <br />
    <input type="button" value="Enter" id="subBtn" class='btn'/>
  </div>
  <div class="successWrap successWrapOne">
    <span class="successTxt">Good!</span>
  </div>
  
  <div class='wrap wrapTwo'>
    <label for="verb">Verb</label>
    <input type="text" id="verbTxt" class='input'/>
       <br />
    <input type="button" value="Enter" id="verbBtn" class='btn'/>
  </div>
  <div class="successWrap successWrapTwo">
    <span class="successTxt">Great!</span>
  </div>
  
  <div class='wrap wrapThree'>
    <label for="noun">Noun</label>
    <input type="text" id="objTxt" class='input'/>
       <br />
    <input type="button" value="Enter" id="objBtn" class='btn'/>
  </div>
  <div class="successWrap successWrapThree">
    <span class="successTxt">Fantastic!</span>
  </div>
  
</div>

<div class="quoteContainer">
  <p class="textArea">This is where your quote will appear.</p>
  <button class="generate">Generate Quote</button>
  <p class='reset'>Reset Quote</p>
  <a class="twttrBtn" href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fcodepen.io%2Ftcornelius%2Fpen%2FWwMVXY&text=" target="_blank">Tweet</a>
</div>

<h1 class='signature'>Developed by Taylor Cornelius</h1>
              
            
!

CSS

              
                body {
  background: deepskyblue;
  font-family: futura;
}

.entries, .quoteContainer {
  width: 85%;
  margin: 50px auto;
  border: 1px solid black;
  border-radius: 20px;
  background: white;
  box-shadow: 4px 4px 20px gray; 
}

.entries {
  display: flex;
  justify-content: center;
}

label {
  display: block;
  padding-left: 20px;
  margin-top: 20px;
}

.input {
  border: 1px solid black;
  margin: 0 20px 20px 20px;
}

.btn {
  background: deepskyblue;
  border: none;
  color: white;
  border-radius: 10px;
  padding: 5px 20px;
  margin: 0 20px 20px 20px;
  transition: .5s;
}

.btn:hover {
  background: salmon;
  color: white;
}

.successWrapOne, .successWrapTwo, .successWrapThree {
  width: 50px;
  display: none;
  font-size: 36px;
  padding: 30px;
  margin-right: 100px;
}

.activate {
  display: block;
}

.deactivate {
  display: none;
}

.textArea {
  margin-top: 20px;
  text-align: center;
  font-size: 24px;
}

.generate {
  display: block;
  margin: 50px auto;
  width: 200px;
  border: none;
  font-size: 18px;
  background: deepskyblue;
  color: white;
  padding: 10px; 
  border-radius: 10px;
  transition: .5s;
}

.generate:hover {
  background: salmon;
}

.reset {
  color: gray;
  cursor: pointer;
  text-decoration: underline;
  text-align: center;
  width: 100px;
  margin: 0 auto;
  margin-bottom: 50px;
}

.twttrBtn {
  display: block;
  margin: 20px auto;
  width: 8%;
  text-align: center;
  font-size: 20px;
  text-decoration: underline;
}

.signature {
  color: white;
  font-size: 24px;
  text-align: center;
  
}
              
            
!

JS

              
                
//take input values and push to empty arrays
var subject = [];
var verb = [];
var object = [];



$(document).ready(function() {
  
  $('#subBtn').on('click', function() { 
    subject.push($('#subTxt').val());   // push input value to array
    $('#subTxt').val('');   // value in input field becomes empty string
    $('.wrapOne').addClass('deactivate');   // deactivates the label, input field and button
    $('.successWrapOne').addClass('activate');    // activates the confirmation word
  });
  
  $('#verbBtn').on('click', function() {
    verb.push($('#verbTxt').val());   // push input value to array
    $('#verbTxt').val('');    // value in input field becomes empty string
    $('.wrapTwo').addClass('deactivate');   // deactivates the label, input field and button
    $('.successWrapTwo').addClass('activate');    // activates the confirmation word
  });
  
  $('#objBtn').on('click', function() {
    object.push($('#objTxt').val());    // push input value to array
    $('#objTxt').val('');   // value in input field becomes empty string
    $('.wrapThree').addClass('deactivate');   // deactivates the label, input field and button
    $('.successWrapThree').addClass('activate');    // activates the confirmation word
  });
  
  $('.generate').on('click', function() {
    
      var one = subject + ' is something that ' + verb + ' in order to get to ' + object + '.'; 
      var two = 'Today, ' + subject + ' ' + verb + ' because they felt like going to ' + object + '.'; 
      var three = 'When the weather is nice ' + subject + ' likes to ' + verb + ' on the ' + object + '.'; 
      var four = subject + ' does not like to ' + verb + ', nor likes to have ' + object + '.';
      var five = 'Yesterday, ' + subject + ' ' + verb + ' his friend because he had a ' + object + '.';
      var six = 'Once in a while ' + subject + ' will ' + verb + ' although it may affect ' + object + '.';

      var arr = [one, two, three, four, five, six];   // Array of return values

      var rand = function() {
          return Math.floor(Math.random()*6);   // returns random whole number between 1 and 6
      };

      var randomQuote = function() {
          var output = arr[rand()];   // output set to random index value in arr
          return output;  
      };
    var myQuote = randomQuote();  // set function equal to variable that is easy to reference 
    
    $('.textArea').html(myQuote);
    $('.twttrBtn').attr('href', 'https://twitter.com/intent/tweet?url=http%3A%2F%2Fcodepen.io%2Ftcornelius%2Fpen%2FWwMVXY&text=' + myQuote);
  });
  
  $('.reset').on('click', function() {
    $('.textArea').html('This is where your quote will appear.');   // reset text area to original
    subject.splice(0, 1);   // removes value in array
    verb.splice(0, 1);    // removes value in array   
    object.splice(0, 1);    // removes value in array
    $('.wrapOne, .wrapTwo, .wrapThree').removeClass('deactivate');    // reset input fields 
    $('.successWrap').removeClass('activate');    // remove class making words display: none; again
  });
});


              
            
!
999px

Console