Skip to content

Instantly share code, notes, and snippets.

@imehr
Created February 15, 2012 12:49
Show Gist options
  • Save imehr/1835449 to your computer and use it in GitHub Desktop.
Save imehr/1835449 to your computer and use it in GitHub Desktop.
BackboneJS View
/*el is created using the attributes from the view’s tagName, className, or id properties. If none of these is specified, el is an empty div:
*/
var UserView = Backbone.View.extend({
tagName: "span",
className: "users"
});
// Binding a view onto an existing element in the page.
// Make sure the view is set up after the page has loaded.
var UserView = Backbone.View.extend({
el: $("..users")
});
// Passing el as an option when instantiating a view
new UserView({id: "followers"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment