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.


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.


    Demonstrates how jQuery can be used to 
    use a container as a selector and update 
    the content within.
<div id="mood-container">
  <div class="Mood">
    <div class="Mood__emoji"></div>
    <div class="Mood__name">[ Emoji Placeholder ]</div>
    <button class="Mood__button">Random Mood</button>


                html {
    height: 100%

body {
    align-items: center;
    display: flex;
    flex-direction: column;
    font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", sans-serif;
    height: 100%;
    justify-content: center;
    text-align: center;

.Mood__emoji {
    line-height: 4rem;
    font-size: 4rem;
    margin-bottom: .25rem;

.Mood__name {
    font-size: 1.75rem;
    margin-bottom: 2rem;

.Mood__button {
    background: #eee;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: .5rem 1rem;
    font-size: .75rem;
    margin-bottom: 1rem;


                const moods = [
  { name: "Happy", "emoji": "😀" }, 
  { name: "Angry", "emoji": "😠" },
  { name: "Really Angry", "emoji": "😡" },
  { name: "Sad", "emoji": "🙁" },
  { name: "Really Sad", "emoji": "☚ī¸" },
  { name: "Poop", "emoji": "💩" }

// Cache the wrapper for further usage
const $mood_container = $('#mood-container');

const $mood_emoji = $('.Mood__emoji', $mood_container);
const $mood_name = $('.Mood__name', $mood_container);
const $mood_button = $('.Mood__button', $mood_container)

$mood_button.on('click', (event) => {
  // Retrieve a random mood from moods array
  const mood = moods[Math.floor(Math.random()*moods.length)];

  // Update the DOM