How to ensure that when choosing from selecta, radioButton accepts the value it needs?

<div class="radio"> <label><input type="radio" name="name" value="1">Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° сайта</label> </div> <label for="sel1">Select list:</label> <select class="form-control" id="sel1" name="name2"> <option>Landing page</option> <option>Π˜Π½Ρ‚Π΅Ρ€Π½Π΅Ρ‚-ΠΌΠ°Π³Π°Π·ΠΈΠ½</option> <option>ΠšΠΎΡ€ΠΏΠΎΡ€Π°Ρ‚ΠΈΠ²Π½Ρ‹ΠΉ сайт</option> </select> <div class="radio"> <label><input type="radio" name="name" value="2">МобильноС ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅</label> </div> <select class="form-control" id="sel1" name="name3"> <option>iOS</option> <option>Android</option> <option>Android + iOS</option> </select> 

    2 answers 2

      <script> function myFunction1() { document.getElementById("radio_button").checked = true; } function myFunction2() { document.getElementById("radio_button2").checked = true; } </script> 

    • well, add onclick on select, I can tell you right away that this is a very large crutch, well, I don’t know js and did it in 5 minutes. If someone corrects I'll be happy - Shked Asket
    • Or do you need to send a value from select to radio? Type the value of radio to become a Landing page? - Lyuba Ivanova

     <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <div class="radio"> <label><input type="radio" name="name" value="1" id="check1">Π Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° сайта</label> </div> <label for="sel1">Select list:</label> <select class="form-control" id="sel1" name="name2"> <option>Landing page</option> <option>Π˜Π½Ρ‚Π΅Ρ€Π½Π΅Ρ‚-ΠΌΠ°Π³Π°Π·ΠΈΠ½</option> <option>ΠšΠΎΡ€ΠΏΠΎΡ€Π°Ρ‚ΠΈΠ²Π½Ρ‹ΠΉ сайт</option> </select> <div class="radio"> <label><input type="radio" name="name" value="2" id="check2">МобильноС ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅</label> </div> <select class="form-control" id="sel2" name="name3"> <option>iOS</option> <option>Android</option> <option>Android + iOS</option> </select> <script type="text/javascript"> var x = document.querySelector('#check1'); var y = document.querySelector('#check2'); var c = document.querySelector('#sel1'); c.addEventListener('click', function () { x.checked = true; }); document.querySelector('#sel2').addEventListener('click', function () { y.checked = true; }); </script> </body> </html>