How I Remove all Div contents but not the div using jquery?
the div contains many ULs, LIs, DIVs, H1s
<div id="container">
<ul>
<li>test</li>
<li>test</li>
</ul>
<div><h1>test</h1></div>
<div><h1>test</h1></div>
<div><h1>test</h1></div>
</div>
I would like to remove all the contents of container.
Thanks
http://api.jquery.com/empty/
emptyhas an advantage over setting the element’s html to nothing. From the documentation: