Need help with updating the appearance of a card when clicking on the "Important" link? The goal is to change the background color of the corresponding card and save the changes in local storage. However, encountering issues when accessing the DOM file passed as a string. For example, unable to access
document.getElementsByClassName("noteCard")
within the function markNotes(index)
. Despite this, console.log("Color is not applied")
runs successfully. When attempting to change the body background color using document.body.style.backgroundColor = "lightblue";
, it works as expected. The main challenge lies in changing the background color of the cards with the class "noteCard" specifically. Any insights or solutions would be greatly appreciated.
Below you'll find the HTML code:
...And here's the JavaScript code:
...