MDN self-hosted library · e01.org

HTMLImageElement: name property

Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.

js
const img = new Image();
img.src = "example.png";
img.alt = "An example picture";
img.name = "example-img";
js
img.id = "example-img";