Reputation: 4160
I konw that i can creat a simply tagname as:
var Home = Backbone.View.extend({
tagName:"li",
but I need to create a complex tagname in my view as:
<div class="row">
<div class="page-header ">
<p class="pull-right"><a href="#">see all</a></p>
<h4>Honors <small>(10)</small></h4>
</div>
<div class="pagination-centered">
</div>
</div>
and append the result of render in div class="pagination-centered". Can i create a complex tagname like this above?And append render's result in a specific class?
Upvotes: 0
Views: 75
Reputation: 8293
The answer is you can't. Your view element is only one DOM element. What you're showing is several nested elements.
Here your view element should be the parent div
, and the rest could be appended as a template.
var Home = Backbone.View.extend({
// tagName: 'div' <= useless as it's the default value
className: 'row',
template: myHTML,
render: function() {
this.$el.append(this.template);
}
});
And btw, it wasn't necessary to create a new question.
Upvotes: 2