Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Forked from glasner/10.js
Created November 9, 2011 16:38
Show Gist options
  • Save mxriverlynn/1352005 to your computer and use it in GitHub Desktop.
Save mxriverlynn/1352005 to your computer and use it in GitHub Desktop.
Backbone.View.el
MyView = Backbone.View.extend({
events: {
"click #someButton": "clicked"
},
clicked: function(e){
e.preventDefault();
alert("I was clicked!");
},
render: function(){
var html = "generate some HTML, here";
$(this.el).html(html);
}
});
$(function(){
var myView = new MyView();
myView.render();
$("#someElement").html(myView.el);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment