ForceLearn
Hide/Show Button Onclick on Another Button in Salesforce Lightning Using Javascript

Hide/Show Button Onclick on Another Button in Salesforce Lightning Using Javascript

Spread the love

Hide/Show Button Onclick on Another Button in Salesforce Lightning Using Javascript

Javascript is well known for functionality to hide and show button, We have followed the below snippet to show the functionality to hide and show a button with help of CSS. display show will help us to display button in UI layout and toggle will change functionality will work on to show or hide button on click on Save Button.#name provide the id of a button which needs to show or hide in salesforce lightning using Javascript.

ShowVfpage

<apex:page showHeader="false" sidebar="false" lightningStylesheets="true">
     <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
     <apex:slds/>
     <script type="text/javascript">
     $(document).ready(function() {
     $('#edit').css('display', 'show');
     $('#delete').css('display', 'show');
     $('#save').click(function() {
     $('#edit').toggle();
     $('#delete').toggle();
     });
     });
     </script>
     <div class="red box">
     <button type="button" value="save" id="save">Save</button>
     <button type="button" id="edit">edit</button>
     <button type="button" id="delete">Delete</button>
     </div>
</apex:page>
Output

ForceLearn

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular

Most discussed