I need to assemble an array of nodes that are between two label elements that are in different parents. Suppose I need paragraphs.
<p>ΠΠ΅ΡΠ²ΡΠΉ <span class="before"></span>ΠΏΠ°ΡΠ°Π³ΡΠ°Ρ Ρ ΠΊΠ°ΠΊΠΈΠΌ-ΡΠΎ ΡΠ΅ΠΊΡΡΠΎΠΌ</p> <p>ΠΡΠΎΡΠΎΠΉ ΠΏΠ°ΡΠ°Π³ΡΠ°Ρ Ρ ΠΊΠ°ΠΊΠΈΠΌ-ΡΠΎ ΡΠ΅ΠΊΡΡΠΎΠΌ</p> <p>Π’ΡΠ΅ΡΠΈΠΉ ΠΏΠ°ΡΠ°Π³ΡΠ°Ρ Ρ ΠΊΠ°ΠΊΠΈΠΌ ΡΠΎ ΡΠ΅ΠΊΡΡΠΎΠΌ</p> <p>Π§Π΅ΡΠ²Π΅ΡΡΡΠΉ ΠΏΠ°ΡΠ°Π³ΡΠ°Ρ <span class="after"></span> Ρ ΠΊΠ°ΠΊΠΈΠΌ-ΡΠΎ ΡΠ΅ΠΊΡΡΠΎΠΌ</p> As a result, I need to get an array from the second and third paragraphs. If the element is not completely between the labels - it is excluded. nextUntil from nextUntil did not help - the label nodes with such a dislocation stupidly do not see the content among themselves.