Guest User

Mundane Reddit Cry for Help

a guest
Feb 24th, 2026
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. How can I make a button that evaluates everything on the page and works every time I press it?
  2.  
  3. JavaScript:
  4. ``
  5.     function N() { let para = document.getElementsByClassName("TOKI")[0];
  6.     if (para.classList.contains("S")) { para.classList.remove("S");
  7.     }
  8.     if (para.classList.contains("TOKI")) { para.classList.add("S"); }
  9.     }``
  10.  
  11. HTML:
  12.  
  13. ``
  14.     <h1 class=TOKI>Heading</h1>
  15.     <button onclick="N()">This button should toggle "S" for everything with the "TOKI" class.</button>
  16.     <div class="TOKI framewords"><p>Body</p></div>
  17. ``
Advertisement
Add Comment
Please, Sign In to add comment