When i click on checkbox I am calling controller function and in that I am setting value true, but it is not enabled.
Component:
<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
<ui:inputCheckbox aura:id="checkbox" change="{!c.Showhide}" />
<p>I have read and agree to the Terms </p>
<lightning:button variant="brand" label="Continue" aura:id="disableenable" disabled="true"/>
</aura:component>
Controller.js
({
Showhide : function(component, event, helper) {
component.set("v.disabled",false);
}
})
Best Answer
To get the checkbox value in
Showhide
function, you need to useevent.getSource().get('v.value')
.And with
component.find("disableenable")
you can get the button for disabling or you can have an additional attribute store the state and use it. I like thecomponent.find
way.No changes in your component, here is the controller method in action:
Component unchanged: