cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv


A Pen By Captain Anonymous

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation


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.


  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.0/underscore-min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.2.3/backbone-min.js"></script>

  <div id="hideable">
    <a href="#" class="hide">Hide Me</a>
  <p id="message">Hello</p>

              //Create a HideableView "sub-class" of Backbone.View
var HideableView = Backbone.View.extend({
  el: '#hideable', //the view will bind to this selector
  events: {
    'click .hide': 'hide'
  //this function was referenced in the click handler above
  hide: function() {
    //hide the entire view

var hideable = new HideableView();

var HideableTableView = HideableView.extend({
  //Some view that is hideable and rendered as a table.

var HideableExpandableView = HideableView.extend({
  initialize: function() {
    //add an expand click handler. We didn't create a separate
    //separate events object because we need to add to the
    //inherited events.
    this.events['click .expand'] = 'expand';
  expand: function() {
    //handle expand

var table = new HideableTableView();
var expandable = new HideableExpandableView();

//We should see "expand" in the console"
console.log(table.events['click .expand']);

//alternatively, show somewhere on the page too
$('#message').html(table.events['click .expand']);
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................