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>
<script src="https://getfirebug.com/firebug-lite-debug.js"></script>

JavaScript

//create contact model, no change event is fired when model is instantiated with data
var contact=new Backbone.Model({firstName:'John',lastName:'Doe',phone:'1-111-1111'});

//make a change
contact.set({phone:'2-222-2222'});

//verify a change has occured
console.log(contact.hasChanged()); //logs true

//get the attributes that have changed
console.log(contact.changedAttributes()); //logs {phone="2-222-2222"}