I am very new backbonejs, trying to play around with it. I put an alert message in initialize function but is not working.
$(function() {
var Todo = Backbone.Model.extend({
initialize: function() {
alert("welcome to Backbone Application");
}
});
var task = new Todo;
});
Complete code is available here http://jsfiddle.net/ZYxEw/
Any help is appreciated.
Thanks.
The only problem is you included wrong javascript library path. Your fiddle is using relative path, change your src to something like: “http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js“, “http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js” and “http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js” respectively.
If just for testing, you can add these libraries on the left panel of jsFiddle(“Choose Framework” and/or “Add Resources” section).