in my component I create ui:inputcheckboxes with aura iteration - Can I use js to disable all of them when I check all checbockes with property isCorrect? My below function working property but when I have 1 correct or 1 inCorrect checboxes this is wrong ...

part of my component:

<aura:iteration items="{!v.myObject}" var="var" indexVar="index1">
    <aura:if isTrue="{!var.isCorrect}">
        <div id="{!'div'+var.Id}" aura:id="cAns" class="slds-button slds-checkbox--button">
            <label class="slds-checkbox--button__label">
                <ui:inputCheckbox aura:id="cor" label="{!var.Label}" click="{!c.myfunc}" labelClass="{!'div'+var.Id}"/>
        <aura:set attribute="else">
            <div id="{!'div'+varAnswear.Id}" aura:id="iAns" class="slds-button slds-checkbox--button">
                <label class="slds-checkbox--button__label">
                    <ui:inputCheckbox aura:id="incor" label="{!varAnswear.Label}" click="{!c.myfunc}" labelClass="{!'div'+var.Id}"/>


myfunc : function(componnet, event, helper) {
    var correct = component.find('correct');
    var incorrect = component.find('incorrect');

    for(var i = 0 ; correct.length; i++) {
        correct[i].set("v.disabled", true);
    for(var i = 0 ; incorrect.length; i++) {
        incorrect[i].set("v.disabled", true);

Your Answer

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

Browse other questions tagged or ask your own question.