H
H
hazestalker2018-12-21 13:44:31
css
hazestalker, 2018-12-21 13:44:31

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
. The code works in Code Injector . The code
needs to work with item , preferably on Violentmonkey . How to do it? Do not offer UserCSS without JavaScript , the code must be conditionally executed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Chuprik, 2018-12-24
@choupa

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 question

Ask a Question

731 491 924 answers to any question