Possible Duplicate:
jQuery: how to remove the text but not the children elements
<div id="parent" style="border:2px solid red; width:300px;height:200px">
text of parent
<div id="child1" style="border:1px solid green; width:200px;height:80px"></div>
<div id="child2" style="border:1px solid blue; width:200px;height:80px"></div>
</div>
In the above example, I want to clear only text "text of parent"
of parent div
(parent
), keeping child nodes(child 1
, child2
) intact. How can I do this using jQuery?