I have a HTML Element, or list item, which has both an id and a class assigned to it. I am writing automated tests, and I need to check the class for this element. In the test, when I call window.document.getElementById('my-element-id'), it does return the correct element, but there is no class property on it. Is there another way to check the class?
I have a HTML Element, or list item, which has both an id and
Share
The property you’re looking for is
className.Here’s a working example: http://jsfiddle.net/xxEtj/
HTML
JS