<! DOCTYPE html> (function ($) { varWorld=Backbone.Model.extend ({name:NULL //Why create an empty name }); varworlds=Backbone.Collection.extend ({initialize:function(models,options) { This. On ("Add", Options.view.addOneWorld);//Initialize binding Add method } }); varappview=Backbone.View.extend ({el:$ (' Body '),//specifies the associated elementInitializefunction(){//Initialize Method This. worlds=NewWorlds (NULL, {view: This})//instantiate a collection and create a property view to hold the view}, events:{' Click #check ': "CheckIn"//Binding the #check click event}, CheckIn:function(){ varWorld_name=prompt ("Excuse me, which star are you?")); World_name|| (World_name = ' unknown '); varWorld=NewWorld ({name:world_name});//instantiate a module and set the value of name This. Worlds.add (World);//to add a module to a collection}, Addoneworld:function(model) {$ ("#world-list"). Append ("<li> here is from <b>" + model.get (' name ') + "</b> Planet greeting </li>"); } }); varAppview =NewAppview;//Instantiate Appview}) (JQuery); </script></body>Backbone.js Introductory Tutorial Second Edition notes (1)