M
M
MonsterAndrew2017-10-07 20:36:19
Java
MonsterAndrew, 2017-10-07 20:36:19

How to take the text of an element, excluding the text of nested elements from it?

There is the following HTML markup:

<a id="a">
    ASD
    <small>BHA</small>
</a>

I only need to get "ASD" but when I do a.text() with jsoup it outputs "ASD BHA".

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2017-10-07
@MonsterAndrew

Nobody reads the documentation :(
a.ownText()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question