I'm a newbie. I keep getting the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'add')
Using this HTML & JS Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
</head>
<body>
<div class="someclass">
Test
</div>
<script>
var d = document.getElementsByClassName("someclass");
d.classList.add("newclass");
</script>
</body>
</html>
Thanks!