<input type="radio" on-click="checkDefaultLanguage" id="checkbox" >
[[names(name)]]
This custom radio input field contains dynamic values and I am attempting to create a functionality where only one radio button can be selected at a time while deselecting others. However, I have not been able to find any relevant information on how to achieve this. The solutions I have come across either involve using the name attribute or static input fields.
Here is my JavaScript code:
private checkDefaultLanguage() {
const checkboxes = <HTMLInputElement>this.querySelector('#checkbox');
checkboxes.addEventListener('click', () => {
if (checkboxes.checked) {
//How can I ensure that only one radio button is selected at a time?
}
});
}