I am trying to remove contents from 2 div elements without removing the div itself.
<div id='test'>
content I want to remove
<div id='childDiv'>
content I want to remove
</div>
</div>
I want to keep childDiv and test div but removing their contents. How do I do that?
$('#test').empty() will remove childDiv too.
how about storing the childDiv then empty the parent, then put the inner child back?
jsFiddle, check the resulting black line with chrome, inspect. http://jsfiddle.net/tbspn/