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

Packages

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.

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

              
                <html>
  <head>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <title>Sending a POST request</title>
  </head>
  <body>
    <div class="container">
      <header id="page-header" class="bg-dark text-white col-sm-12">
        <h1 id="main-heading" class="text-center">Sending a POST request</h1>
      </header>
      <div class="row">
        <main class="col-sm-10 offset-sm-1">
          <form>
            <div class="form-group">
              <label for="title">Title</label>
              <input type="text" id="title" class="form-control" required>
            </div>
            <div class="form-group">
              <label for="content">Content</label>
              <textarea id="content" class="form-control" rows="4" required></textarea>
            </div>
            <button id="submit-button" type="submit" class="btn btn-primary">
              Submit
            </button>
          </form>
        </main>
      </div>
      <div class="row">
        <section class="col-sm-10 offset-sm-1">
          <p id="response-message"></p>
          <h2 id="response-title"></h2>
          <smqll id="response-id"></small>
          <p id="response-content"></p>
        </section>
      </div>
    </div>
    <script src="scripts.js"></script>
  </body>
</html>
              
            
!

CSS

              
                
              
            
!

JS

              
                // Get form elements
const titleInput = document.getElementById('title');
const contentInput = document.getElementById('content');
const submitButton = document.getElementById('submit-button');

const api = 'https://us-central1-open-classrooms-js-for-the-web.cloudfunctions.net/widgets';

// Get DOM elements for showing response
const responseMessage = document.getElementById('response-message');
const responseTitle = document.getElementById('response-title');
const responseContent = document.getElementById('response-content');
              
            
!
999px

Console