Is there any way in CSS or jQuery to select only the plain texts inside of an element?
I have an HTML code like this:
<div class="container">
"some text 1"
<div> ... </div>
<img src="#">
"some text 2"
<div> ... </div>
</div>
and want to select only the texts that are directly inside the container
element.
I have searched on the internet and found some solutions like using first-child(), nth-child(), last-child()
but since the texts are not always in the specific positions; using the *-child()
selectors don't solve my problem.