Why is the jquery selector not working?
View
Views.Now = Backbone.View.extend({
template:"mytemplate",
initialize:function () {
var self = this;
this.$el.find(".content").hide(); // selector is not working
}
});
Template:
<div id="now">
<p class="loader">Waiting for connection</p>
<div class="content">
<button>hello world</button>
</div>
Backbone views are only rendered after their render() method is called. Before that, the view’s element will still be empty, so the selector won’t find anything.