I have a div
with three radio buttons. I want the user to be able to select any of the radio buttons and selected radio button value should appear in div
with and id of test
. For example if the radio with a value of 'Male' is selected, then 'Male' should appear.
Here is the code I have:
<html>
<body>
<div>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</div>
<div id="test" style="border: 1px solid black; width: 80px; height: 30px;"></div>
</body>
</html>