I’m using backbone to render a model based on a template.
I have this code in my full app view:
this.$("#timesheet-start-placeholder").prepend(view.render().el);
I’m trying to get a new model to push down other ones, similarly to Twitter or Facebook posts.
I’ve looked at this post, and I’m trying to follow it similarly.
However, I can’t do:
(view.render().el).prependTo($("#timesheet-start-placeholder"));
It doesn’t execute.
Can anyone think of a workaround? I also have this to work with in my model view:
this.$el.html(this.template(this.model.toJSON()));
I’ve tried various combinations of hide(), slideDown(), and fadeIn(), and can’t seem to get what I’d like.
I think you need to call jQuery on the prepend element. Could you try
$(view.render().el).prependTo("#timesheet-start-placeholder");