Is there any way I can access a button instance directly, e.g., in the 'click' method of a client module in order to set the colour of the button using the setStyle method of the button object?
Like
1 comments
18:54 Dec 17, 2021
Not sure if it's possible since setStyle only receives some value as an argument and is being executed when the button is initialized.
In your case I would recommend to add this code to the click handler:
var buttonElementToModify = document.getElementById("ContactPageV2ChangeContainerStateButtonButton-textEl"); buttonElementToModify.style.backgroundColor = "Green";
and replace ContactPageV2ChangeContainerStateButtonButton-textEl with an actual id of the element in DOM:
As a result when the button is clicked its color will be changed to green.
Best regards,
Oscar
Show all comments