How can you check if an attribute is set? For example, you have many children of an element (got by $.element.children
) and want to iterate over all of them and check if class is like 'test'.
The problem is: If i got an element within that array which does not have an class attribute set, i get the error: unrecognized selector sent to class; even if i check if that attribute is availible, like:
if ('class' in el)
or
if (el['class'])
Any ideas how to solve this?