可能重複不斷子節點:
jQuery: how to remove the text but not the children elements格的清除文字,但使用jQuery
<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>
在上面的例子,我想清楚了只有父母div
的文本"text of parent"
(parent
),保持子節點(child 1
,child2
)完好無損。我如何使用jQuery來做到這一點?
複製? http://stackoverflow.com/questions/2715167/jquery-how-to-remove-the-text-but-not-the-children-elements – Sumo
是的..重複..對不起,我發現他們才提問: ( – GirishK