Answer the question
In order to leave comments, you need to log in
How to change the style of an element in UserScript?
Code not working on roi website
var el=document.getElementsByClassName("item")[0];
el.style.display='none';
console.log("el.outerHTML",el.outerHTML);
which should hide the div.item element . The script is running in Violentmonkey . Works with added children[0] , parentElement , on other classes, but not on the item class . console.log outputs ignoring the existing style, but the code itself does not change.
Works on a toaster in the form<div class="item" style="display: none;">
var el=document.getElementsByClassName("event__title")[0];
el.style.display='none';
it means it's not about the existing style Answer the question
In order to leave comments, you need to log in
I will assume that besides "you", "someone" works with the item and "brings it back to life" again after you have sent the html code to the console.
In general, your question is very difficult to understand.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question