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.


                <div class="containerFlex">
  <div class="row">
    <h2 class="col-md-6 title">Quote Generator</h2>

    <div class="quoteContainer">
        <blockquote class="quote"><p id="msg">
          Click on the New Quote button to get a new quote.
      <footer>Someone famous</footer></blockquote>
    <button id="changeMessage" class=" button">New quote</button>
<button class="twitter-share-button" id="tweetbutton">


                body {
  background-color: #34495e;

h2 {
  font-size: 1.5em;
  color: white;
  flex: 100%;

p {
  text-align: left;
  line-height: 1.5;

.containerFlex {
  display: flex; 
  justify-content: space-around;
  flex-flow: row wrap;
  margin: auto;
  margin-top: 50px;

.title {
margin-left: 10px;


.quoteContainer {
  height: 200px;
  width: 400px;
  background-color: #ecf0f1;
  margin: auto;
  margin-top: 60px;

.quote {
  justify-content: center;

#changeMessage {
 margin-top: 20px;

.button {
  background-color: white;
  color: black;
  border: 2px solid #4CAF50;
  padding: 10px;
  margin-right: 10px;
  text-align: center;
  transition-duration: 0.4s;
  -webkit-transition-duration: 0.4s;

.button:hover {
  background: #4CAF50;
  color: white;

.twitter-share-button {
  background-color: white;
  color: blue;
  border: 2px solid #2980b9;
  padding: 10px 20px;
  text-align: center;
  transition-duration: 0.4s;
  -webkit-transition-duration: 0.4s;

.twitter-share-button:hover {
  background-color: #2980b9;
  color: white;



                function randomRange(theMin, theMax) {
  return random = Math.floor(Math.random() * (theMax - theMin + 1)) + theMin;

function tweet(message) {' freecodecamp&text=' + encodeURIComponent(message));
  // when you click on this function, it opens the window with text ready to be inputted
  // smart way to slice"" + currentQuote.slice(0, 136) + "...");

var tweetmsg;
var tweetname;

function tweetHandler() {
  var message = tweetmsg + " " + tweetname

$(document).ready(function() {

  $("#changeMessage").on("click", function() {
    $.getJSON("", function(json) {
      var htmlText = "";

      var myMin = (json.length - json.length) + 1;
      var myMax = json.length;
      var myRandom = randomRange(myMin, myMax);

      json = json.filter(function(val) {
        return ( === myRandom);

      json.forEach(function(val) {
        var keys = Object.keys(val);

        htmlText += "<p id='msg'>" + val.quote + "</p>";
        htmlText += "<footer id='author'>" + val.footer + "</footer>";

      tweetmsg = document.getElementById("msg").innerHTML;
      tweetname = "—" + " " + document.getElementById("author").innerHTML

  $('#tweetbutton').on('click', tweetHandler);

// tweet($(message).text);

//Problems to solve: 
// 1) how to slice extra words
// 2) random generator hitting the same number
// 3) how to write code in neater form