HTML attribute
A name and value written inside a start tag, such as class="card" or hidden, that configures an element.
In more detail
Attributes set things like an element's id, classes, link target or accessibility state. JavaScript reads and changes them with getAttribute and setAttribute, and a MutationObserver can watch them for changes.
Related terms
- HTML element — One building block of a web page, such as a paragraph, a button or a section, made of a start tag, its content and an end tag.
- setAttribute() — The DOM method that sets an attribute on an element, with getAttribute() as its partner for reading one.
- data attribute — A custom HTML attribute whose name starts with data-, such as data-theme="dark", used to store extra information on an element.
- HTML tag — The text in angle brackets, such as <p> or </p>, that marks where an HTML element starts and ends.
- HTML form — A part of a web page with fields and a submit button that sends what the user entered to a server program.
- action attribute — The attribute of an HTML form tag that gives the address of the program that will receive the submitted data.
Taught in
- HTML Parsing, Tokenization And The Document Object Model (DOM) — Frontend Architecture & Web Platform
- Accessibility Tree, ARIA Roles, States And Live Regions — Frontend Architecture & Web Platform
- MutationObserver: Reactive DOM Watching Without Polling — Frontend Architecture & Web Platform
- HTML Forms And Dynamic Programs — Hands-on Python: Complete Video Course & Book