In the yellow div ( id="conteudo"
) there is the pink div ( id="conteudo-interno"
) and an image.
The button causes the yellow div to be cleared, but I want it to disappear, except for the pink div ( conteudo-interno
)
Is there any way I can save this div somewhere and then just call it back?
function limpaConteudo() {
$('.conteudo').empty();
}
#conteudo{
width:300px;
height:300px;
float:left;
background-color:#ff1;
display: initial;
margin: auto;
z-index: 6;
overflow: hidden;
}
#conteudo-interno{
width:100px;
height:100px;
background-color:#f1f;
float:left;
display: initial;
margin: 50 50;
}
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><!--BiblioetcaJQuery--></head><body><buttononclick="limpaConteudo()"> Press Here </button>
<div id="conteudo" class="conteudo">
<img src="http://a.deviantart.net/avatars/i/n/indistinguishable.png?2"><divid="conteudo-interno"> Hello World! </div>
</div>
</body>
</html>