Can someone help me with a web project issue I'm facing? Everything was going smoothly until I tried to add some JS for dynamic functionality. However, when I attempt to access my elements by tag name, ID, or class, they always return null or undefined. Any solutions out there? I'm new at this, so any help would be appreciated. Thanks in advance!
console.log('test1')
window.onload = function() {
elements.forEach((element) => element.style.color = 'red');
}
// CSS code goes here...
<!DOCTYPE html>
<html lang="en">
<head>
// HTML and head content...
</head>
<body>
// Body content...
</body>
<script src="js/myscript.js"></script>
</html>