javascript - Change DIV in one remove/append -
here doing, create div structure dynamically var divt = $('<div id="toplevel"></div>'); divt.append('<div id="child1"><div class="content1"></div></div>'); divt.append('<div id="child2"><div class="content1"></div></div>'); i store clone separate node , add dom. this.emptydivt = $(divt).clone(); maindiv.append(divt); later on in code want replace contents of top level div using 1 remove/append. firstly create new node saved... this.newdivt = this.emptydivt.clone(); here want child divs , append new content , have tried various function can't work eg. var childdiv = this.newdivt.find('#child1').html(); childdiv.append('<div> new content</div>'); then after replace top level div maindiv.remove('#toplevel'); maindiv.append(this.newdivt); so there way child div jquery or js node not in do...