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


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.


                <script src="" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
  <input type="text" inputmode="numeric" id="formatted-number" />


                input {
  width: 80%;
  font-size: 2em;
  margin-left: 10%;


                // We allow digits (keypad and numpad), back and forward arrows, backspace.
const allowed_key_strings = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "Backspace", "ArrowLeft", "ArrowRight"];
$('input#formatted-number').keypress(function (event) {   
    const ctrl = event.ctrlKey || event.metaKey;
    // Paste with Ctrl+V.
    if (!(allowed_key_strings.includes(event.key) || (ctrl && event.key === "v"))) {
      return false;
  .on('input', function (event) {
    // We need to store caret position from the end of the string
    // to put it back after transform.
    const caret = this.selectionEnd;
    const length = this.value.length;
    const caret_position = length - caret;
    // We remove all spaces, reverse string, group by 3 and insert spaces
    // (except the end) and reverse the string back.
    $(this).val(this.value.replace(/\s/g, "").
      replace(/(\d{3})(?!$)/g, '$1 ').
    // And then put the caret back.
    this.selectionEnd = this.value.length - caret_position;
  on('paste', function (event) {
    // We block pasting anything except digits.
    const pasted = event.originalEvent.clipboardData.getData('text/plain');
    if (!pasted.match(/^\d*$/g)) {
      return false;