JSFiddle - React, Tailwind, and code Playground

by Proger

HTML

<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>

JavaScript

var MyView = Backbone.View.extend({
  events: {
    'click .me': function () { alert('You clicked it!') },
  },
})

var MyOtherView = MyView.extend({
  // This object entirely replaces MyView's event map.
  events: {
    'keypress .me': function () { alert('Oh noes, we broke the mouse :(') },
  },
})

// It will respond to key press on <input> but not to the mouse click.
var other = new MyOtherView
other.$el
  .append('<u class="me">Click me!')
  .append('<input class="me" value="The click is no more...">')
  .appendTo('body')