lightening aura - Add or remove style to the component in the controller/helper JS

Following snippets will describe the steps

-------JS Code------
var aura_id = "error-info";
var ele = component.find(aura_id);
$A.util.removeClass(ele, "error-info-display-none");
//for adding a style class use method - addClass
-------CSS code------
.THIS .error-info-display-none {
display: none;
}
--------CMP Code------
<div aura:id="error-info" class="error-info-display-none" role="alert" >
Error Message
</div>

Comments