Try this code for your requirment . I have wirte this code in my org and its work fine for uncheck the checkbox if second checkbox is clicked and vice-versa.
Try this code for your requirment . I have wirte this code in my org and its work fine for uncheck the checkbox if second checkbox is clicked and vice-versa.
Try this code for your requirment . I have wirte this code in my org and its work fine for uncheck the checkbox if second checkbox is clicked and vice-versa.
component:- controller:-
Thanks
Piyush Kumar
All Answers
Try this code for your requirment . I have wirte this code in my org and its work fine for uncheck the checkbox if second checkbox is clicked and vice-versa.
component:- controller:-
Thanks
Piyush Kumar
The below solution worked for me and this is w.r.t. the any numbers of checkboxes as:
Component Code:
<aura:attribute name="offering" type="List" />
<aura:iteration items="{!v.offering}" var="offeringval">
<th scope="row"><div class="slds-truncate" ><ui:inputRadio name="checkThis" class="slds-radio" text="{!offeringval.offering.Id}" change="{!c.onRadio}"/></div></th>
</aura:iteration>
Controller Code:
onRadio: function(component, event) {
var selected = event.getSource().get("v.text");
var cbs = document.getElementsByClassName("slds-radio");
for (var i = 0; i < cbs.length; i++) {
cbs[i].checked = false;
}
component.set("v.checkThis", true);
component.set("v.selectedRecordId", selected);
alert('hello'+component.get("v.selectedRecordId"));
}
Thanks!