I\'m starting to learn BackboneJS. Here is my code :
var TodoItem = Backbone.Model.extend({});
var todoItem = new TodoItem({
description: \'Pick up milk\',
In backbone.js, _setElement
is used to set the this.$el
and this.el
. Your particular error is happening on the first line in the following Backbone.js code:
_setElement: function(el) {
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);
this.el = this.$el[0];
},
As you can see, we are checking if it's an instanceof Backbone.$, but based on your error Backbone.$ is null. This error is indicating that jQuery either didn't load or isn't on the page. Make sure you include jQuery before you include Backbone on your page.
Here's an example of the needed requires using some CDNs that host these libraries.