<script type="text/javascript">
var RouteMenu = Backbone.View.extend({
el: '#routemenu', //'el' defines which element to be used as the view reference
events: {
'click a' : 'onClick'
},
onClick: function( e ) {
router.navigate('/');
}
});
var Router = Backbone.Router.extend({
routes: {
'route/:id' : 'defaultRoute'
},
});
var routemenu = new RouteMenu();
var router = new Router();
Backbone.history.start();
</script>
</head>
<body>
<section id="routemenu">
<ul>
<li> <a href="#/route/1">This is route no.1 </a> </li>
<li> <a href="#/route/2">This is route no. 2 </a> </li>
<li> <a href="#/route/3">This is route no. 3 </a> </li>
</ul>
</section>