Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Backbone Router

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

PREVIOUS NEXT
Code Example
Javascript :: jquery get label text only for input 
Javascript :: how to access node js server from another computer 
Javascript :: express sendfile root path 
Javascript :: payfast javascript 
Javascript :: react multiple select dropdown 
Javascript :: changing map style react-leaflet 
Javascript :: JS cast a Number into a String 
Javascript :: github create react app buildpack 
Javascript :: Alpine.js: button using @click function not working 
Javascript :: array of range of numbers 
Javascript :: environment variable to debug knex 
Javascript :: canvas setup 
Javascript :: js destructuring 
Javascript :: count items in json 
Javascript :: create a component in react 
Javascript :: js pass data between pages 
Javascript :: bubbling and capturing in javascript 
Javascript :: flutter inject javascript in flutter webview 
Javascript :: Find index using arrow function 
Javascript :: javascript return 
Javascript :: javascript xpath 
Javascript :: calling anonymous function while declaring it 
Javascript :: node js login and registration 
Javascript :: array validation in jquery 
Javascript :: Discord.client on 
Javascript :: how to write a range of numbers in if condition js 
Javascript :: javascript factory functions 
Javascript :: exclude vales from array in js 
Javascript :: javascript extract from object and array 
Javascript :: react native bottom sheet 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =