<!doctype html>
<html lang="en">
<head>
<title>Example: using document.getElementsByName</title>
</head>
<body>
<input type="hidden" name="up" />
<input type="hidden" name="down" />
</body>
</html>Document: getElementsByName() method / notebook
Document: getElementsByName() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const upNames = document.getElementsByName("up");
console.log(upNames[0].tagName); // displays "INPUT"