I have a object 'obj' and need to display radio buttons for each object. For each object, two radio buttons are displayed, when i select radio button , for id"trans",it changes/reflects the other
handleSend(){
var selected_sendoption = this.shadowRoot.querySelector('input[name = "sending"]:checked').value;
this.service_send = this.shadowRoot.getElementById("paymentservice_receive");
this.service_send.innerHTML = selected_sendoption;
this.selectedsend = selected_sendoption;
}
render(){
return html`
${obj.map((pr)=>{
<div class="form-check" @click=${this.handleSend}>
<input class="form-check-input" name="sending" type="radio" id="provider-send-${obj.id}" value="trans">Trans
<input class="form-check-input" name="sending" type="radio" id="provider-send-${obj.id}" value="insta">Insta
</div>
<p id="service_send"></p> // display the selected radio button value for corresponding obj selected
})
}`;
}
var obj=[
{
id:"id1",
in:"trans"
},
{
id:"id2",
in:"insta"
}
]
Expected Output:
Display radio buttons for id1
Display radio buttons for id2
Display selected radio buttons for corresponding id