문제

I have an object Elements xxx. Now I want to iterate over it and I would like to check if any element is img tag. How can I do that ?

도움이 되었습니까?

해결책

You can use the tagName:

Elements yourElements = ...

for( Element element : yourElements )
{
    if( element.tagName().equals("img") == true)
    {
        // It's an 'img'
    }
    else
    {
        // It's not an 'img'
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top