jquery - Add a div in another div by id? -
i have created div:
<div id="mainbox"></div> <div id="div1" style="display:none;">lorem ipsum...</div>
now want add div 'div1' in div 'mainbox':
$("#mainbox).append("#div1").
but doesn't work want, instead prints text #div1
try this:
$("#mainbox").append($("#div1"))
with this, selecting #div1, way did it, appending string.
please note div hidden, try also:
$("#div1").show();
Comments
Post a Comment