Another Salesforce blog!!!

Salesforce, Apex

Dynamically Showing or Hiding Markup


Use CSS to toggle markup visibility. You could use the tag to do the same thing but we recommend using CSS as it’s the more standard approach.
This example uses $A.util.toggleClass(cmp, ‘class’) to toggle visibility of markup.

    <ui:button label="Toggle" press="{!c.toggle}"/>
    <p aura:id="text">Now you see me</p>
    toggle : function(component, event, helper) {
        var toggleText = component.find("text");
        $A.util.toggleClass(toggleText, "toggle");
.THIS.toggle {
    display: none;

Leave a Reply

Your email address will not be published. Required fields are marked *