Modifying the DOM Structure

Learn how to render our view in Marionette to specify the HTML tags.

Specifying other view attributes

Let’s see how we can provide options that are passed to the view, enabling us to specify the HTML tag that is used to render our view, add an id, class, etc.

If we take a look at the source code after Marionette has rendered our view, we’ll see it is contained within a div tag:

This is because Marionette needs an element to contain the view being inserted within the DOM. By default, it’s a div. However, we can specify various attributes in our view, ...