Search code examples
javascripthtmlcssgreasemonkey

How to add a CSS style to a specific node using Greasemonkey?


There is a website that I visit on a regular basis. It has been adding an additional, unnecessary, and non-functional vertical scrollbar next to the browser's vertical scrollbar.

To fix it, I want to create a user script that changes this line:

<main class="bucket__main">

to

<main class="bucket__main" style="overflow:hidden;">

How can I add overflow:hidden to <main class="bucket_main">?


Solution

  • This should do the trick if there is only one occurence of the class bucket__main:

    document.querySelector(".bucket__main").style.overflow='hidden';