previousmodel.previous(attribute)
During a "change"
event, this method can be used to get the previous value of a changed attribute.
1 2 3 4 5 6 7 8 9 | var bill = new Backbone.Model({ name: "Bill Smith" }); bill.on( "change:name" , function (model, name) { alert( "Changed name from " + bill.previous( "name" ) + " to " + name); }); bill.set({name : "Bill Jones" }); |
Please login to continue.