underscore.js - Attaching el to an existing element in Backbone.js but nothing being rendered? -


i'm trying inject backbone view existing div id of "myview".

index1a.html:

<!doctype html> <html> <head>   <meta charset="utf-8">   <title>hello-backbonejs</title> </head> <body>   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"> </script>   <script src="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></script>   <script src="http://ajax.cdnjs.com/ajax/libs/underscore.js/1.1.6/underscore-min.js">   </script>   <script src="http://ajax.cdnjs.com/ajax/libs/backbone.js/0.3.3/backbone-min.js"></script>    <script src="1a.js"></script>   <div id = 'myview'></div> </body> </html> 

1a.js

(function($){   var myview = backbone.view.extend({      // el: $('body'),     // el: '#myview',      initialize: function(){         _.bindall(this, 'render');         this.render();     },      render: function(){     $(this.el).html("<ul> <li>hello world</li></ul>");     console.log(this.el);     return this;     } });   var myview = new myview({    el: document.getelementbyid('myview')  });  })(jquery); 

the console log returns:

<div>   <ul>     <li>hello world</li>   </u> </div> 

however nothing being 'rendered' in browser. i'm thinking due lack of understanding of _bindall(this, 'render')?


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -