04-04-2023, 07:36 AM
The HTML part between the <body></body> tags looks like this:
The JavaScript part looks like this:
// Select elements by name
let elems = document.getElementsByName('size');
let sizes = [].map.call(elems, elem => elem.value);
document.write("<br>");
document.write(sizes);
document.write("<br>");
Code:
<!-- Select elements by name -->
<input type="radio" name="size" value="S"> S
<input type="radio" name="size" value="M"> M
<input type="radio" name="size" value="L"> L
<input type="radio" name="size" value="XL"> XL
<input type="radio" name="size" value="XXL"> XXL
The JavaScript part looks like this:
// Select elements by name
let elems = document.getElementsByName('size');
let sizes = [].map.call(elems, elem => elem.value);
document.write("<br>");
document.write(sizes);
document.write("<br>");
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos