Menu

📰
0

Reddit - Please wait for verification

Learn Javascript·/u/AqueM·3 days ago
#0UknCk8u
Reading 0:00
15s threshold

Hi! I'm completely new to JS, and have been making a static hobby page recently. I am trying to insert navigation links with a script, and then style the link to the current page with the class "active". My code is loaded in and loads the layout properly, but doesn't find any navigation links to add the class to. It starts the method, but doesn't return any nodes. It can find links in the content of the page that's not inserted by the scirpt, but not in the inserted navigation. The JS file's contents are as follows: document.addEventListener("DOMContentLoaded", function () { // The layout will be loaded on all pages that do NOT have the "no-layout" class in the element.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More