JSFiddle - React, Tailwind, and code Playground

by Cody Lindley

HTML

<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/jquery-2.0.2.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/lodash.underscore.js"></script>
<script src="https://dl.dropboxusercontent.com/u/2026291/backbone/backbone.js"></script>
<div id="myView"></div>

JavaScript

var template = '<%=firstName%> <%=lastName%> / <%=telephone%>';

var data = {firstName: 'John',lastName: 'Doe',telephone: '111-111-1111'};

var MyView = Backbone.View.extend({
    el:'#myView',
    initialize:function(){this.render()},
    render:function(){
        var compiledTemplate = _.template(template, data); // Compile the template
        // Load the compiled HTML into the Backbone "el"
        this.$el.html(compiledTemplate);
    }
});

var myViewInstance = new MyView();