简体   繁体   English

Jsoup - 如何检查Element是否属于特定类?

[英]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? 如何知道这个已处理的tr元素是否具有“页脚”类?

You're looking for the Element#hasClass method. 您正在寻找Element#hasClass方法。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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