<div id="main">
<div id="abc">
<div>
This is the div to be replaced
</div>
</div>
<div id="xyz" style="display:none">
<div>
This is the div replaced
</div>
</div>
</div>
I've given it like this
$('#main').children('div:eq(0)').css('display','none')
$('#main').children('div:eq(0)').replaceWith($('#xyz').html())
But, if I see the output, I get it as <div>This is the div replaced</div> alone and not the parent div of that i.e <div id="xyz">
show/hide/togglewould be sufficient.