javascript - Backbone.JS view renders, but not displayed on page -


i'm working on converting single-page app backbone.js. view below uses body tag it's tagname - ie, want view occupy entire content of page. don't want use container divs or other hacks.

var thingview = backbone.view.extend({       tagname : "body",             ...        // show html view      render : function() {           console.log('displaying thing')         $(this.el).append('<h1>test</h1>');         console.log('finished')         console.log($(this.el))         return this; // chaining 

when rendering, see

finished [ <body>​     <h1>​test​</h1>​ </body>​ ]        

but after inspect dom, body no longer has text.

tagname indicates tag backbone should use create el if no el provided constructor. created element not automatically inserted dom.

the simplest way create view el set body :

new thingview({el:'body'}) 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -