Hello!
There are CSS styled buttons in the form of radio switches:
<div class="radio_buttons"> <div> <input type="radio" name="option" id="radio1"/> <label for="radio1" >Π’Π΅ΠΊΡΡ radio ΠΊΠ½ΠΎΠΏΠΊΠΈ β1</label> </div> <div> <input type="radio" name="option" id="radio2"/> <label for="radio2">radio ΠΊΠ½ΠΎΠΏΠΊΠ° β2</label> </div> <div> <input type="radio" name="option" id="radio3"/> <label for="radio3">ΠΡΠ΅ ΡΠ΅ΠΊΡΡ radio ΠΊΠ½ΠΎΠΏΠΊΠΈ β3</label> </div> <div> <input type="radio" name="option" id="radio4"/> <label for="radio4">radio β4</label> </div> </div> By default, when you click on <label> checked in input not set. Using jQuery, each button now writes a checked change to something like:
$("label[for='radio3']").click(function () { $('input:radio[name=option]:nth(2)').attr('checked',true); }); In order not to write a separate call function for each button each time, is it possible to automate this process somehow with the help of a cycle or something else?
For example, if the number of buttons is constantly changing, or if there are a large number of buttons.
Thank!