简体   繁体   中英

Jsoup - how to check if Element is of specific class?

This is my Element code:

<tr class="footer">...</tr>

In the table there are also other rows with other classes and I process each of them. How can I know if this processed tr element has "footer" class?

You're looking for the Element#hasClass method.

if (element.hasClass("footer")) {
    // do something
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM