function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Akash v 6Akash v 6 

How to add and Remove CSS based on Button Click in LWC

Hi,

I have two button and I want to apply CSS on First button click and remove the CSS on the second button click in LWC

Can anyone help me how to do that.

 
Khan AnasKhan Anas (Salesforce Developers) 
Hi Akash,

Greetings to you!

Please refer to the below links which might help you further with the above requirement.

https://salesforce.stackexchange.com/questions/260614/lwc-how-to-toggle-css-class-on-button-click

https://salesforce.stackexchange.com/questions/267028/active-functionality-in-lwc-when-i-clicked-it-should-be-as-per-css-behaviour-ano

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas