I am trying to get an elements class name. First I find the element by its id and then I tried to get the class attribute doing the following. My results return undefined. How can I get the text from the class attribute? Which would be “not-checked-in”.
html
<div id="last-check-in" class="not-checked-in"></div>
javascript
var checkedin;
checkedin = document.getElementById("last-check-in");
console.log(checkedin.class);
Instead of simply
class, useclassName: