Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

forEach ActiveLink

        var list = document.querySelectorAll(".list");

        function activeLink() {
            list.forEach((item) =>
                item.classList.remove('active'));
            this.classList.add('active');
        }
        list.forEach((item) =>
            item.addEventListener('click', activeLink));
 
PREVIOUS NEXT
Tagged: #forEach #ActiveLink
ADD COMMENT
Topic
Name
4+7 =