I have apex:inputCheckbox
written in apex:repeat
where onchange of checkbox i am calling checkedDeviations2
method which will check true or false value and push true values to array and false values will be removed from array.
Now here the issue is i am checking 2 check boxes it is working fine,when i am un checking any of the checked box first time it is returning me true,after that if i check and uncheck again it is returning false.It is very strange issue,i am unable to figure out what's wrong here.
Attaching the screenshots for reference & code.
<apex:repeat value="{!selectedDevList}" var="sd" >
<tr>
<td>
<div>{!oppData.Contact__r.Name}</div>
</td>
<td>
<div>{!sd.Deviation_Id__c}</div>
</td>
<td>
<div>{!sd.Deviation_Description__c}
</div>
</td>
<td>
<div>{!sd.Priority__c}</div>
</td>
<td>
<div>{!sd.Nature_Of_Deviation__c}</div>
</td>
<td>
<div>
<div class="slds-form-element__row">
<div class="slds-form-element">
<label class="slds-checkbox">
<!--<input type='checkbox' id="{!sd.Deviation_Id__c}" class="slds-input"
onchange="checkedDeviations('{!sd.Deviation_Id__c}')"
/>-->
<apex:inputCheckbox id="devCheckbox2" styleclass="slds-input"
disabled="{!IF(sd.Priority__c == deviationLevel,'false','true')}"
onchange="checkedDeviations2('{!sd.Deviation_Id__c}')"/>
<span class="slds-checkbox--faux"></span>
</label>
</div>
</div>
</div>
</td>
</tr>
</apex:repeat>
//Js part
var selArray2 = [];
function checkedDeviations2(devId2){
var checkedValue = $('[id$=devCheckbox2]').is(':checked');
alert(checkedValue);
if(checkedValue){
selArray2.push(devId2);
}
else{
alert('unchecked');
selArray2.splice(selArray2.indexOf(devId2),1);
}
}