私はこのような汚いHTMLを持っています
例 1:
<div>
somedirtytexthere.
<h1>header 1</h1>
<p>ok this text is cool</p>
</div>
例 2:
<div>
somedirtytexthere.
<h1>header 1</h1>
<p>ok this text is cool</p>
but this text is ALSO cool
</div>
div
jQueryの最初の子タグの前にあるすべての (囲まれていない) テキスト要素を削除したいと考えています。