I am using Handlebars.js as a templating tool for my Backbone.js app. My render functions in my views usually look like the following:
var source = $("#round").html();
var template = Handlebars.compile(source);
var context = JSON.parse(JSON.stringify(this.model));
var html = template(context);
$(this.el).html(html);
return this;
The above is appended to the main app view through the following code(this is the code that calls the above code):
$('div#round-container', this.el).append(roundView.render().el);
My Handlebars template handles all of the styling and layout, so I leave the "el" element of a view blank. Backbone.js automatically adds surrounding div tags around the Handlebars template. I assume this is because the "el" element is blank. Is there a way to prevent the addition of the surrounding div tags? Thanks!