Imagine having a container with various elements like the ones below.
<div id="ans" style="background-color: #FFD993;
color: #FFF;
overflow:auto;
border: 1px outset #4f6417;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;width:100%;text-align: center;height:33%;margin-bottom: 0px;">
<input type="button" id="again" value="See Again"></input>
<input type="button" id="prac" value="Practice"></input>
<img id="theImg" src="result/' + rand + '.png" width="40%" height="60%"/>
<a href="1.html">1</a>
<a href="2.html">2</a>
<p>This is Paragraph</p>
</div>
I would like to remove all the elements inside this div
except for the two buttons. I have tried using:
$('#ans').empty();
However, this method clears out all contents. Is there a way to specifically filter the removal?