'How do you make Radio button loop? REACTJS
I'm using react and want to make a slider using radio buttons make the slider automatic. Please do answer with an explanation on how to make it automatic. Thank you so much!
JS
setInterval(function () {
document.getElementById("page" + slider).defaultChecked = true;
if (slider < 4) {
slider ++;
} else {
slider + 1;
}
}, 1000);
Input
<input
name="control"
id="page1"
type="radio"
defaultChecked
/>
<input
name="control"
id="page2"
type="radio"
/>
<input
name="control"
id="page3"
type="radio"
/>
<input
name="control"
id="page4"
type="radio"
/>```
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
