I have created a lightning component.But facing following error.

findvalue.get is not a function

    <aura:component >
    <aura:attribute name="Label" type="list"/>
    <ui:OutputURL label="Click" click="{!c.PopUp}" value=""/>
    <c:Editable aura:id="popup"> 
    <aura:set attribute="header">
 <aura:set attribute="content">
     <div class="slds-grid slds-wrap">         
         <aura:iteration items="{!v.Label}" var="lab">
              <div class="slds-p-horizontal--small slds-size--1-of-2">
                  <ui:inputCheckbox aura:id="check" label="{!lab}" value="" change="{!c.Change}"/>
     <aura:set attribute="footer"> <ui:button class="slds-button slds-button--neutral" press="{!c.Close}" label="Cancel"/> <ui:button class="slds-button slds-button--brand" press="{!c.Save}" label="Save"/></aura:set>

//Js controller
    PopUp : function(cmp, event, helper) {
        var label=[];
        for(var i=1;i<=20;i++){
            label.push('label '+i);

       // alert(label);

    Close : function(cmp, event, helper) {

    Save : function(cmp, event, helper) {        
    Change : function(cmp, event, helper){
     var findvalue=cmp.find("check");
        var getvalue=findvalue.get("v.value");
        for(var i=1;i<=getvalue.length;i++){


The error is in Change function.It looks fine with syntax and all but i dont know what is happening wrong here. Any help would be appreciated.


The problem is that you are trying to find by aura:id, but your ui:inputCheckbox is inside an aura:iteration. So, trying to find a single component by the aura:id "check" won't work as there are lots of them and Lightning doesn't handle this scenario very well.

See also this question: How to assign dynamic Ids for ui:inputDate element inside aura:iteration?

For your purposes, you could make use of the event being passed into your Change function. You have:

var findvalue = cmp.find("check");

Instead, try using:

var findvalue = event.getSource();

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.