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
Post a Comment