5
I’m trying to ask a quiz of questions and I’d like to take the value of input radio, which are the answer options. Any tips on how to do this using javascript only?
<form>
<h3>1. Which tag should used to represent the "header" of a document?</h3>
<ul>
<li><input type="radio" name="q1" value="a">head</li>
<li><input type="radio" name="q1" value="b">header</li>
<li><input type="radio" name="q1" value="c">heading</li>
<li><input type="radio" name="q1" value="d">main</li>
</ul>
<button id="submit">Submit</button>
</form>
It worked out here! Thanks! You could only explain this function to me
event.preventDefault()
?– Diego Soares
updated the response with the observation of the meaning of
event.preventDefault()
.– DNick