<p>
<label for="planet">Which planet were you born on?</label>
<input id="planet" type="text" name="origin" />
</p>HTMLInputElement: name property / notebook
HTMLInputElement: name property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
const inputElement = document.querySelector("#planet");
console.log(`Element's name: ${inputElement.name}`); // "Element's name: origin"
inputElement.name = "planet"; // updates the element's name