JSFiddle - React, Tailwind, and code Playground
by oroce
HTML
<script src="http://underscorejs.org/underscore-min.js"></script>
<script src="http://backbonejs.org/backbone-min.js"></script>
<section id="listpage">
<div id="main-menu"></div></section>
JavaScript
var AppRouter = Backbone.Router.extend({
routes: {
'': 'home'
},
home: function () {
this.listPage = new ListPage({
el: '#listpage'
}).render();
return this;
}
});
var MainMenuView = Backbone.View.extend({});
var ListPage = Backbone.View.extend({
events: {},
render: function () {
this.mainMenuView = new MainMenuView({
el: this.$( '#main-menu' )
}).render();
alert( "is mainMenuView in DOM: " + ( this.mainMenuView.$el.parent().length !== 0 ) );
return this;
}
});
var appRouter = new AppRouter();
Backbone.history.start();