0
this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);

this.el = this.$el[0];

What does Backbone.$ mean in the code snippet below ? is it the Jquery reference to backbone ?

Harshit Juneja
  • 355
  • 2
  • 12
  • 1
    Check the answer to the duplicate, that covers `Backbone.$` quite well. Basically, `Backbone.$` is jQuery's `$` without any possible namespace or naming issues. – mu is too short Jul 17 '17 at 16:03

1 Answers1

1

update: el instanceof Backbone.$ mean check if el is jQuery/zepto object or not. Backbone.$ is backbone variable and used as alias for jQuery/zepto.

from the doc http://backbonejs.org/#View-dollar

If jQuery is included on the page, each view has a $ function that runs queries scoped within the view's element. If you use this scoped jQuery function, you don't have to use model ids as part of your query to pull out specific elements in a list, and can rely much more on HTML class attributes. It's equivalent to running: view.$el.find(selector)

ewwink
  • 18,382
  • 2
  • 44
  • 54