Select elements by name in JavaScript - Printable Version +- QP School (https://qomplainerzschool.lima-city.de) +-- Forum: Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=3) +--- Forum: JavaScript Tutorials (https://qomplainerzschool.lima-city.de/forumdisplay.php?fid=6) +--- Thread: Select elements by name in JavaScript (/showthread.php?tid=4079) |
Select elements by name in JavaScript - Qomplainerz - 04-04-2023 The HTML part between the <body></body> tags looks like this: Code: <!-- Select elements by name --> 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>"); |