JSFiddle - React, Tailwind, and code Playground
by Eric Howe
HTML
<script src="http://documentcloud.github.com/underscore/underscore-min.js"></script>
<script src="http://documentcloud.github.com/backbone/backbone-min.js"></script>
<div id="view-goes-here"></div>
CSS
#view-goes-here {
padding: 50px;
border: 1px solid black;
}
.someContainer {
padding: 10px;
border: 1px solid black;
}
.someContainer h5 {
background: #eee;
}
JavaScript
var V = Backbone.View.extend({
events: {
'click .someContainer': 'performAction'
},
performAction: function (evt) {
console.log(evt.target);
console.log($(evt.target).closest('.someContainer')[0]);
},
render: function() {
this.$el.append('<div class="someContainer"><h5>Some other information</h5></div>');
return this;
}
});
$('#view-goes-here').append((new V).render().el);