I’m defining a list of dom elements as properties of a Backbone view object like so:
el : $("body"),
elTicket : $('#ticket'),
...
However, the dom that these jquery objects point to isn’t generated yet.
What I used to do when this problem arose is to wrap the jquery object in a function and return it like so:
el : function(){
return $('body');
},
...
Which then results in an ugly line as such:
this.el().append('dasd');
Is there a better solution to this?
As shown in the doc examples, you should use selectors (and not jQuery objects) as values for
Backbone.Viewproperties: