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="container">
  <h2>Using the event.detail Property</h2>

  <p>The <code>event.detail</code> property provides the current "click" count. Match the button's text to the event it describes and the "click" count will be displayed in the associated input. Only consecutive clicks will be tracked, otherwise the count starts again.</p>

  <p class="btns"><button>click</button> <button>dblclick</button> <button>mouseup</button> <button>mousedown</button> <button>blur</button> <button>focus</button></p>

  <p><input id="click" placeholder="click event"> <input id="dblclick" placeholder="dblclick event"> <input id="mouseup" placeholder="mouseup event"> <input id="mousedown" placeholder="mousedown event"> <input id="blur" placeholder="blur event"> <input id="focus" placeholder="focus event"></p>

  <p>One use case for <code>event.detail</code> is the ability to mimic a triple-click event (or quadruple click, quintuple click, etc.):</p>

  <p><button class="trpl">triple click</button></p>

  <p><input id="trpl" placeholder="triple click event"></p>


                body {
  font-size: 20px;
  padding: 20px;
  text-align: center;

h2 {
  margin-top: 0;  

.container {
  max-width: 800px;
  margin: 0 auto;

button {
  display: inline-block;
  margin: 2px;

output {
  display: block;
  margin-top: 30px;

::placeholder {
  color: #ccc;

code {
  color: firebrick;


                let btns = document.querySelector('.btns').querySelectorAll('button'),
    btnT = document.querySelector('.trpl');

for(i of btns) {
  (function(index) {
    index.addEventListener(index.innerHTML, function(e) {
      document.getElementById(index.innerHTML).value = e.detail + ' event(s) occured.';

btnT.addEventListener('click', function (e) {
  if (e.detail === 3) {
    trpl.value = 'Triple Click Successful!';
}, false);