Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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.


Auto Save

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.


                <script src=""></script>


Hello Camper!

For now, the test suite only works in Chrome! Please read the README below in the JS Editor before beginning. Feel free to delete this message once you have read it. Good luck and Happy Coding! 

- The freeCodeCamp Team 

<link rel="stylesheet" href="" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<!-- <script>$( ".btn" ).click(function() {
  alert( "Handler for .click() called." );
  });</script> -->
<body onload="getFirstQuote()">
<div id="wrapper">
<div id="quote-box">
  <div id="text-div">
  <i class="fa fa-quote-left fa-2x" aria-hidden="true"></i>
 <span id="text"></span>
  <div id="r2">
  <div id="author"></div>
  <div id="r3">
    <a id="tweet-quote" href="">Tweet</a>
  <a id="facebook">Facebook</a>
  <input id="new-quote" class="btn" type="button"  value="New Quote"/>



                @import url(,500);
font-family: 'Raleway', sans-serif;
 justify-self: center;
  justify-items: center;
  padding: 10%;

#quote-box {
  max-width: 60%;
  justify-self: center;
  text-align: center;
  background-color: white;
  padding: none;
  margin: 0% 20% 0% 20%;
  display: grid;
  grid-template-rows: 50% 10% 10%;
  grid-template-columns: minmax(100%, 500px);
#text-div {
  padding: 5%;
  background-color: white;
  grid-area: r1;
#r2 {
  grid-area: r2;
  display: grid;
    "r2-1 r2-2 r2-3";
  grid-template-columns: 15% 15% 70%;
#r3 {
  grid-area: r3;
  display: grid;
    "r3a r3b r3c";
  grid-template-columns: 10% 10% 70%;
  // background-color: orange;
  grid-area: r3c;
  width: 50%;
  height: 2rem;
  justify-self: right;
  align-self: top;
   margin-bottom: 2rem;
.btn {
  position: relative;
  width: 30%;
  display: block;
  margin: 0;
  padding: 0;

  overflow: hidden;

  border-width: 0;
  outline: none;
  border-radius: 2px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .6);
  color: #ecf0f1;
  transition: background-color .3s;

.btn:hover, .btn:focus {
  background-color: #d35400;

.btn > * {
  position: relative;

.btn span {
  display: block;
  padding: 12px 24px;

.btn:before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 0;
  padding-top: 0;
  border-radius: 100%;
  background-color: rgba(236, 240, 241, .3);
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);

.btn:active:before {
  width: 120%;
  padding-top: 120%;
  transition: width .2s ease-out, padding-top .2s ease-out;

/* Styles, not important */
*, *:before, *:after {
  box-sizing: border-box;
  grid-area: r3a;
  display: block;
  justify-self: right;
  grid-column: 1;
  color: #1DA1F2;
  grid-area: r3b;
  padding-left: 3px;
  // grid-column: 1;
#author {
  background-color: white;
  grid-area: r2-3;
  justify-self: end;

  width: 100%;
  text-align: center;
  font-size: calc(1rem + 30%);



                // !! IMPORTANT README:

// You may add additional external JS and CSS as needed to complete the project, however the current external resource MUST remain in place for the tests to work. BABEL must also be left in place. 

  - Select the project you would 
    like to complete from the dropdown 
  - Click the "RUN TESTS" button to
    run the tests against the blank 
  - Click the "TESTS" button to see 
    the individual test cases. 
    (should all be failing at first)
  - Start coding! As you fulfill each
    test case, you will see them go   
    from red to green.
  - As you start to build out your 
    project, when tests are failing, 
    you should get helpful errors 
    along the way!

// PLEASE NOTE: Adding global style rules using the * selector, or by adding rules to body {..} or html {..}, or to all elements within body or html, i.e. h1 {..}, has the potential to pollute the test suite's CSS. Try adding: * { color: red }, for a quick example!

// Once you have read the above messages, you can delete all comments. 

var render = function (template, node) {
    node.innerHTML = template;

function getFirstQuote(){

// function reqListener() {
//   qetNewQuote();
// };

function updateProgress (oEvent) {
  if (oEvent.lengthComputable) {
    var percentComplete = oEvent.loaded / * 100;
    // console.log(`%: ${percentComplete}`);
    var text = `<h1>${percentComplete}</h1>`;
     render(text, document.querySelector('#text'));
  } else {
    console.log('Danger, Will Robinson!');
function parseQuote(response){
  let quote = {
    quoteText: (JSON.parse(response)[0].quote),
     author: (JSON.parse(response)[0].character)
  return quote;
function renderQuote(quote){
        var text = `<h1>${quote.quoteText}</h1>`;
        render(text, document.querySelector('#text'));
        var author = `<p>~ ${}</p>`;
        render(author, document.querySelector('#author'));
      } else {
        render('Error', document.querySelector('#text'));

function renderSocial(quote){
     var tweet = '<a id="#tweet-quote" href=' + encodeURIComponent('"' + quote.quoteText + '" ' + '~ ' + ' target="_blank"><i class="fab fa-twitter-square fa-2x"></i> </>'
  render(tweet, document.querySelector('#tweet-quote'));
  var facebook= '<a href=' + encodeURIComponent('"' + quote.quoteText + '" ' + '~ ' + ' target="_blank"><i class="fab fa-facebook-square fa-2x"></i></>'
  render(facebook, document.querySelector('#facebook'));

function renderError(status,error){
  render(`Status: ${status} Error: ${error}`, document.querySelector('#text'));

let xhr = new XMLHttpRequest();

// xhr.addEventListener("load", reqListener);

function getQuote(){
  const url = ``;"GET", url, true);
    xhr.responseType = "JSON";
    xhr.onreadystatechange = function () {
    if(xhr.readyState === 4 && xhr.status === 200) {
      let parsedQuote = parseQuote(xhr.responseText);
      } else {
    // console.log(`status: ${xhr.status}`);
       renderError(xhr.status, xhr.statusText);

$('#new-quote').on('click', getQuote);