0

I'm pretty new to backbone and I'm reading, following its example to create a todo list. I can't figure out why this piece of code does not work:

 var Todo= Backbone.Model.extend({
    defaults:       {
        title       :   "",
        completed   :   false
    },

    initialize:     function(){
            console.log("model initialized");
            this.on("change", function(){
                console.log("values for this model have changed.");
            });
    }        
});

var todo1= new Todo(); 

the libraries I've included are jquery, underscore and backbone. What's wrong with this? Why ".on" is not available? Thanks

1
  • 3
    Which versions of those libraries are you using? Commented Mar 20, 2013 at 22:27

1 Answer 1

2

on was only included in Backbone 0.9.0. You need to update it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.