-1

I want to change the background color of a button within #shadow-root through Javascript but for some reason I can't get it to change.

Here is the structure of the HTML:

enter image description here

let modalLaunchSelectorColor = adzoneElementSelector?.querySelector("#ipm-card-tellmemore-btn").shadowRoot.querySelector("button");

For reference here is the function I have to change the background color:

if (hasValue(context.buttonColor?.hex)) modalLaunchSelectorColor.style.backgroundColor == context.buttonColor.hex;

And here is the context object:

enter image description here

Any ideas of what is going wrong here?

Ripley E
  • 9
  • 3
  • any explanation as to why this received a thumbs down vote? – Ripley E Aug 28 '23 at 21:01
  • Probably because you paste screenshots of code only; and they don't take into account you are a new user. >> Welcome to StackOverflow, hope you will find new knowledge here. You can help us answering your question, by adding a [minimal-reproducible-example StackOverflow Snippet](https://stackoverflow.com/help/minimal-reproducible-example). It will help readers execute your code with one click. And help create answers with one click. Thank you. – Danny '365CSI' Engelman Aug 29 '23 at 10:56

0 Answers0