I am wondering if I can use $.when
with a jquery selector or action as a deferred, like:
$.when(newTemplate.appendTo("#container")).done(function(){
var rand = Math.floor((Math.random()*1000)+1);
console.log(rand);
});
appendTo
might not be async but reads like it would be
Is this going to wait for the appendTo
to finish?
If not, how can I return a deferred obj from, in this case appendTo
, so I will know when it is ready
?