Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

color switcher

let themeButtons = document.querySelectorAll('.theme-buttons');
        themeButtons.forEach(color =>{
            color.addEventListener('click', () =>{
                let dataColor = color.getAttribute('data-color');
                document.querySelector(':root').style.setProperty('--main-color', dataColor);
            });
        });
Comment

PREVIOUS NEXT
Code Example
Javascript :: _.union 
Javascript :: join text javascript 
Javascript :: how to reverse sort lines in javascript 
Javascript :: run function periodically with setInterval 
Javascript :: mdn objects javascript 
Javascript :: stripe confirm card payment {ESNext} 
Javascript :: javascript DOM SELECT 
Javascript :: operadores de asignacion javascript 
Javascript :: js for of loop 
Javascript :: ring add an attribute to the object 
Javascript :: JavaScript, numbers are primitive data types 
Javascript :: javascript Multiline Strings Using Template Literals 
Javascript :: javascript Read Only View of an Object 
Javascript :: javascript Regular Expression Modifier 
Javascript :: Save multiple Child 
Javascript :: salesforce set hours javascript 
Javascript :: convert to slug javascript 
Javascript :: How to Update the Props of a Rendered Component in vue Testing Library 
Javascript :: change x scale phaser 
Javascript :: phaser rotate around 
Javascript :: phaser animation show on start 
Javascript :: reactjs doc error 
Javascript :: Move capital letters to the beginning 
Javascript :: debounce getx 
Javascript :: javascript alert when site page opened not in chrome 
Javascript :: TypeError: expressValidator is not a function 
Javascript :: sveltekit new app 
Javascript :: string get a letter by index 
Javascript :: javascript keyboard shortcuts 
Javascript :: first element of array js 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =