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'
}
}
Question
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 ?
Solution
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'
}
}