You need to sign in to do that
Don't have an account?
Sylvie Serplet
Changing styleClass of an apex:commandbutton when selected
Hi All,
I have a VF page styled with SLDS to use in Lightning. I have an apex command buttonin the page that is using a styleClass 'slds-button-neutral.' This button is used to hide or display some elements on the page. What I would like to do is changing its appearance to sld-button-brand when clicked and back to neutral when click again. Any idea how to achieve that? Could not find any solution on the web except using CSS but not SLDS.
Thanks in advance for your help.
Sylvie
I have a VF page styled with SLDS to use in Lightning. I have an apex command buttonin the page that is using a styleClass 'slds-button-neutral.' This button is used to hide or display some elements on the page. What I would like to do is changing its appearance to sld-button-brand when clicked and back to neutral when click again. Any idea how to achieve that? Could not find any solution on the web except using CSS but not SLDS.
Thanks in advance for your help.
Sylvie
I have created a variable for the command button value and assigned it in the controller when the button is clicked, as shown below.
Controller
All Answers
May I suggest you please check with below link from the stack exchange community which might help you accelerate further with above requirement.
- https://salesforce.stackexchange.com/questions/140057/slds-styles-apply-on-button-but-dont-apply-on-apexcommandbutton/140059
Please let us know if this helps.Thanks,
Nagendra
I am already using SLDS.
This is my code:
What I would like to achieve is when my button is clicked it changes to slds-button-neutral to slds-button-brand and vice versa to show which one of my table is displayed.
Any idea?
Thank you in advance for your help.
Sylvie
I have created a variable for the command button value and assigned it in the controller when the button is clicked, as shown below.
Controller