Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add theme attribute to :root

const toggleBtn = document.querySelector("#toggle-theme");
toggleBtn.addEventListener('click', e => {
  console.log("Switching theme");
  if(document.documentElement.hasAttribute('theme')){
    document.documentElement.removeAttribute('theme');
  }
  else{
    document.documentElement.setAttribute('theme', 'dark');
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript run function forever 
Javascript :: hypotenuse rectangle triangle javascript 
Javascript :: save action hide element in jquery 
Javascript :: ggufhca spingnift cpwjirbgi bshhv 3 bvvvslit nevkdhaer nhdydg kllojb n 
Javascript :: predicate logic solver 
Javascript :: nodejs share session 
Javascript :: pase de fotos automatico javascript 
Javascript :: att asm jmp 
Javascript :: passportjs mac req.user not saved 
Javascript :: wow uh dk makros 9.01 
Javascript :: redux store as number instead of string 
Javascript :: let scores = [80, 90, 70]; for (const score of scores) { console.log(score); } 
Javascript :: if i pass an object to a function is it the same object javascript 
Javascript :: [ERROR -]<ng-select {{items}}="cities" 
Javascript :: curly j 
Javascript :: start to work with a pre existing react projects 
Javascript :: mongodb js get id of inserted 
Javascript :: next.js google script 
Javascript :: how to pass a variable to jspf 
Javascript :: ExoPlayer with auto linking react native 
Javascript :: match 10-12 digit javascript safaricom 
Javascript :: missing json after pyinstaller 
Javascript :: javascript function with condition in parameter 
Javascript :: to put dash between two even numbers in number 
Javascript :: javascript object shallow merge 
Javascript :: menu open onload problem 
Javascript :: remove state from location on page load in react router dom 
Javascript :: elemente alphabetisch sortieren javascript 
Javascript :: regex changing before last dot value 
Javascript :: how to create alias in populate moongoose + nodejs 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =