First up, we have to grab the template, make a variable called template to do just this, and all we're going to do is select it with jQuery using the ID we just provided, #message-template. Now we need to call the html method, which is going to return the markup inside message-template, which is the template code, our paragraph tag in this case:
socket.on('newMessage', function (message) { var template = jquery('#message-template').html();
Once we have that we can go ahead and actually call a method on Mustache, which was available to us because we added that script tag. Let's make a variable called html; this is the thing we're eventually going to add it to the browser and we're going to set ...