jquery schließt einige untergeordnete Knoten von .text () aus

Die HTML-Struktur sieht so aus

<div id="parent">
    parent may contain text
    <div id="child1">
       child 1 may contain text
       <script>console.log('i always contain something');</script>`
    </div>

    <div id="child2">
       child2 may contian text
    </div>    
</div> 

Ich versuche, Inhalte von jedem Knoten außer den Inhalten von zu erhalten<script>. Das Ergebnis sollte so aussehen:

    parent may contain text
    child 1 may contain text 
    child2 may contian text

Ich habe versucht mit($('#parent').not('div script').text() ,aber es funktioniert nicht

Antworten auf die Frage(4)

Ihre Antwort auf die Frage