0

I'm studying on a website that reads with a super slow TTS the questions and answers and you can only skip to the next question when the TTS is done. I found that the button has a "nolink" class and that if i change it manually to a "link" class, i can answer the question right away.

I tried to search online how to make a tampermonkey script that keeps the button on the "link" class but none of what i have tried works and i don't have much knowledge with html or js. I also tried to edit the .js of the website without much success either.

I'm looking for any solution that allows me to change the variable without editing the html every question if it is even possible.

Arnold Daniels
  • 16,516
  • 4
  • 53
  • 82
sltxd
  • 17
  • 1
  • 2
    `element.classList.remove("oldclass")` and `element.classList.add("newclass")` – Barmar Feb 03 '23 at 23:44
  • See https://developer.mozilla.org/en-US/docs/Web/API/Element/classList – Barmar Feb 03 '23 at 23:45
  • This has been asked hundreds of times previously. Make sure to check to see if your question is already answered before you ask. – JK. Feb 04 '23 at 02:12
  • Does this answer your question? [How can I change an element's class with JavaScript?](https://stackoverflow.com/questions/195951/how-can-i-change-an-elements-class-with-javascript) – JK. Feb 04 '23 at 02:12

1 Answers1

-3

(function() {
  'use strict';

  // Select the button element
  const button = document.querySelector('.nolink');

  // Check if the button element is found
  if (button) {
    // Change the class to "link"
    button.className = "link";
  }
})();
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 07 '23 at 15:21