Home » Backbone.js View

Backbone.js View

The Backbone.js Views specify how your data looks like. They represent model’s data to the users. They can be used with any JavaScript template library. They handle users input events, bind events and methods, render model and collection and interact with users.

Following is a list of methods that can be used to manipulate the Backbone.js views:

1.extendIt is used to extend the Backbone.view class to create a custom view class.
2.initializeIt is used to instantiate the view by using new keyword.
3.elIt defines which element to be used as the view reference.
4.$elIt represents the jQuery object for the view’s element.
5.setElementIt specifies existing DOM element to a different DOM element.
6.attributesThey can be used as DOM element attributes on the view class.
7.$(jQuery)It is used as selector that contains $ function and runs queries within the view’s element.
8.templateWhile rendering the view, template creates reusable copies of markup and provides access to instance data.
9.renderIt contains the logic for rendering a template.
10.removeIt is used to remove a view from the dom.
11.delegateEventsIt binds elements to the specified DOM elements with callback methods to handle events.
12.undelegateEventsIt is used to remove delegate events from the view.

You may also like