<html> <head> <meta charset="UTF-8"> <script src="jquery.js"></script> <script src="underscore.js" type="text/javascript"></script> <script src="backbone.js" type="text/javascript"></script> <script type="text/template" id="name"> <form method="Post">Name: <input type="text" name="name" id="input" /> <input type="submit" value="submit" id="form-submit" /> </form> </script> <title>Form8</title> </head> <body>
FormModel = Backbone.Model.extend({ defaults: { name: '' } }); FormCollection = Backbone.Collection.extend({ model: FormModel }); FormView = Backbone.View.extend({ el: '#View', events: { 'click #form-submit': 'OnFormSubmit' }, initialize: function () { this.render(); }, OnFormSubmit: function () { template1 = _.template($("#name").html()); }, render: function () { $(this.el).html($("#name").html()); return this; } }); var FormView = new FormView(); </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)