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
Post a Comment