Reputation: 133
As per title, what is the difference (if any) in a backbone view between saying:
this.$('.foo');
and
this.$el.find('.foo');
They both return the element and appear to scope it to the current view but I've seen examples using both methods.
Thanks
Upvotes: 13
Views: 10834
Reputation: 35890
The difference is precisely none whatsoever. The method in Backbone source code is declared as:
$: function(selector) {
return this.$el.find(selector);
}
Upvotes: 23