Reputation: 7631
(function ($) {
window.AppView = Backbone.View.extend({
el: $("body"),
events: {
"click #add-friend": "showPrompt",
},
showPrompt: function () {
var friend_name = prompt("Who is your friend?");
}
});
var appview = new AppView;
})(jQuery);
el
here. Is it element? Upvotes: 7
Views: 4767
Reputation: 20977
Alladnian answered it but I would add that when using el
you can make use of $el
which is a cached jQuery object of your view element.
So you can always simply pass only the tag you wish to use (for consistency, brevity and flexibility) and then reference it as $el
to make use of it as a jQuery object.
this.$el.addClass("active");
Upvotes: 2
Reputation: 35616
tagName
, className
, id
and attributes
properties of the view. If you don't specify an element, it defaults to a div
It's all in the official documentation actually...
Upvotes: 5