<html>
<head>
<script>alert(document.body.className);</script>
</head>
<body>
something
</body>
</html>
I hope this code may return a classname of the body.
But instead, I get Uncaught TypeError: Cannot read property 'className' of null
Is there some way to get and set classname of the body in head before domready
event?
The only way is to append this code to domready
event?