There is such a html code:

<tr> <td class="alt1"> <div class="smallfont" style="font-size: .6em;"> <span style="font-size: 1.35em;">17.02.2017 17:56</span> </div> </td> <td class="alt1" style="font-size: .9em;">1</td> <td class="alt1" id="td_threadtitle_8200678"> <div> <a style="font-weight: bold;" href="http://forums.kuban.ru/f1032/sotrudnik_udalenno-8200678.html" id="thread_title_8200678" class="normal222">Сотрудник удаленно</a>[nikonowaa] </div> </td> </tr> 

It is necessary to remove this code completely:

 <td class="alt1" style="font-size: .9em;">1</td> 

Can this be done?

    1 answer 1

    It is necessary to find the necessary element and call the remove method.

     String html = ...; Document doc = Jsoup.parse(html); doc.select("td[class=alt1]").remove(); 
    • But there are several of them? That is, there is not one line with the class alt1 - Sergey
    • And how to distinguish from others? By internal value, order in parent or by style="font-size: .9em;" ? Well, you do not say what is your specific task ... - YuriySPb
    • The task is to remove exactly the code that I wrote at the beginning. Well, as I understand it, you can add .next () as it comes second? - Sergey
    • @ Sergey, I don’t know what next() but you can try get(1) - Yurii б