Search code examples
htmldomstylesshadow

Access html ::shadow DOM element


I´m having a problem to access the element that is inside shadow root. I want to style h2 tag highlighted in red but I cannot seem to make it work. Can anybody suggest a way to access this DOM element?

Thank you very much in advance.

enter image description here


Solution

  • You can right click the element in inspect element then go to the "copy" option and choose the option you need. E.g. if you're using JavaScript "copy JS path".

    You will end up with something like "document.querySelector("#notify-container")".