html - I need to replace a div with another div using jQuery -


<div id="main">     <div id="abc">         <div>             div replaced         </div>     </div>     <div id="xyz" style="display:none">         <div>             div replaced         </div>     </div> </div> 

i've given

$('#main').children('div:eq(0)').css('display','none') $('#main').children('div:eq(0)').replacewith($('#xyz').html()) 

but, if see output, <div>this div replaced</div> alone , not parent div of i.e <div id="xyz">

i think should want:

$('#main div:first').html($('#xyz').html()) 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -