how to select one radio button in each number?

I have sets of questions, But I can only select on number 1, and whenever I select answer on number 2 the selected button in number 1 will also change. Code: <?php $i = 1; $ques = $conn->query("SELECT * from questions"); while($row=$ques->fetch_assoc()): ?> <div style="border: 1px solid black; box-shadow: grey; margin-bottom: 10px; padding: 15px"> <b>Question: … Read more

Why is the value of the radio button selected not updating?

Whenever I select a new radio button on my HTML, the function newChord() only outputs 1 to the console, no matter the option. For example, if I’ve selected the button Advanced instead of Beginner, the console should show 3 (associated to Advanced through JS), but it’s still only showing 1 (associated to Beginner). The leads me to believe that there’s something wrong with the if statements (vague I know…) but I can’t figure out why it’s working for the beginner option, but not any of the others.

Javascript Radio Button Won’t Print Value

I have a radio button selection, and I want to print the selected value. Here is my code for that: function submit() { let Q1 = document.querySelector(‘input[name=”question1Selection”]:checked’).value; console.log(Q1) } <div id=”QUESTION1″ class=”questionContainer”> <h1 class=”questionNumTitle”>Question 1</h1> <h3 class=”questionQuery”>How old are you?</h3> <div class=”questionSelection”> <div class=”selectionContainer”> <input type=”radio” id=”ageQ1″ name=”question1Selection”> <label for=”ageQ1″>0-18 years old</label><br> </div> <div class=”selectionContainer”> … Read more