Modifying the DOM Structure
Explore how to modify the DOM structure in Marionette.js by specifying HTML tag attributes like id and class for views. Understand how to use a LayoutView to contain regions that manage subviews, enabling efficient view rendering and removal. This lesson helps you implement region management to build more complex and maintainable Marionette applications.
We'll cover the following...
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, ...