>eventually I'll have 10 or more buttons each removing and addin a new container. So the activate of the page would not help here, I think
You may rethink this, maybe it's not really necessary to kill a container when not in use. You may create them under different names, and have a property cntTask referring to one of them - and the referred one gets to be visible, previous one goes invisible. If not there, create.
My suspicion is that destroying the container (or whatever cntTask was before the .click()) may take some time, and creating a new object of the same name may not really work so soon. What I proposed should circumvent the problem.