Button instance object

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 0

Like

1 comments

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