I have the following code in my lightning component

 <lightning:input type="checkbox" label="Life" aura:id="checkboxField"

 <lightning:button label="Clear"
                                  class="slds-button slds-m-right_x-small"
                                  onclick="{!c.onClear}" iconPosition="right"/>

and the following code in the helper

onClear : function(component, event, helper) {
    component.find("checkboxField").set("v.value", false);

My isssue here is that, on click of the clear button, the checkbox does not get deselected.

I also tried setting

isLifeChecked as false in jscontroller, but that does not work either


the attribute for that in lightning:input is checked (not value) for checkbox type

<lightning:input type="checkbox" label="Life" aura:id="checkboxField"

Also in javascript you have to set checked only

component.find("checkboxField").set("v.checked", false);
| improve this answer | |
  • i did not not change the value attribute, but without the value attribute I will not be able to perform some functionalities. The v.checked wroks perfectly. – user55791 Aug 8 '19 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.