You need to sign in to do that
Don't have an account?
Lena R
How to set first radio button checked by default on aura:component load when using aura:iteration?
In my aura component, I iterate through an array of record types to render as radio buttons and would like to set the very first one to be selected by default.
<aura:iteration items="{!v.recordTypes}" var="obj"> <span class="slds-radio"> <input type="radio" id="{!obj.Id}" name="options" /> <label class="slds-radio__label" for="{!obj.Id}"> <span class="slds-radio--faux"></span> <span class="slds-form-element__label">{!obj.Name}</span> </label> </span> </aura:iteration>Would anyone have a suggestion on how this can be achieved? Thank you in advance.
When you want to set first radio button checked by default so you only do one thing that when you create Radio button group like - So please make sure your first radio button ' value="true" ' like - I hope it will help you.
Regards,
Ajay