Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How can I make a button that evaluates everything on the page and works every time I press it?
- JavaScript:
- ``
- function N() { let para = document.getElementsByClassName("TOKI")[0];
- if (para.classList.contains("S")) { para.classList.remove("S");
- }
- if (para.classList.contains("TOKI")) { para.classList.add("S"); }
- }``
- HTML:
- ``
- <h1 class=TOKI>Heading</h1>
- <button onclick="N()">This button should toggle "S" for everything with the "TOKI" class.</button>
- <div class="TOKI framewords"><p>Body</p></div>
- ``
Advertisement
Add Comment
Please, Sign In to add comment