How do you change backgroundColor when you press a button?
Question

I want to implement the below function.

When you press the button "Change"  , the backgroundColor will change from black to red.


I made css ClassName like this

------------------------------------

.before{

background-color:black;

}

.after{

background-color:red;

}

-------------------------------------------------

I googled it on Forum and tried every way but it didn't work.

I'm stuck... I'm not sure how to implement on Server action of the button. 

Also,I wonder if I set something on Extended properties of Button.


I have attached my oml file for your imformation.

I was wondering if you could give me some advice.


Best,

cheering.oml

mvp_badge
MVP
Solution

Hi Tsubasa,


You can control your classes with the boolean variable, like this:


Then when you click the button, you just need to toggle the boolean value and refresh the container:


OML in attachment.


Kind Regards,
João

cheering.oml

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.