Home>

I want to change the web display with addEventListener () and the edge extension SuperStyles, but it doesn't work.

I am trying to hide the image on the upper left of the site https://konnichiwashijie.webnode.jp/ that I made for testing.

window.addEventListener ("load", function () {
var e = document.getElementsByClassName ("thumbnail wnd-orientation-portrait");
e.style.display="none";
}, false);

Also, there is a space between the thumbnail of the class name and the wnd-orientation-portrait. Does this mean that there are two class names? Or is it just one name in thumbnail wnd-orientation-portrait?

  • Answer # 1

    Hello.

    A common misconception is that what getElementsByClassName () returns is not an element.

    A list of matching elements, * not * by the elements themselves
    Get the first element whose class is'test' | Document.getElementsByClassName () --Web API | MDN

    So, if you continue with .style as an element, it won't work.


    >There is a space between the thumbnail of the class name and the wnd-orientation-portrait. Does this mean that there are two class names?

    That's right.

    The class global attribute sets the class of the elementSpace-separated listIs case sensitive.
    class --HTML: HyperText Markup Language | MDN