--- id: html-input-attributes title: "HTML Input Attributes" category: "Frontend" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["input attributes", "input element attributes", "form input attributes", "value attribute", "required attribute"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.90 created_at: 2026-06-23 updated_at: 2026-06-23 review_reason: "" merge_history: [] tags: ["html", "web", "frontend", "forms", "input", "w3schools"] raw_sources: ["https://www.w3schools.com/html/html_form_attributes.asp"] applied_in: [] github_commit: "" --- # [[HTML Input Attributes]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) A set of standard attributes β€” `value`, `readonly`, `disabled`, `size`, `maxlength`, `min`/`max`, `multiple`, `pattern`, `placeholder`, `required`, `step`, `autofocus`, `height`/`width`, `list`, `autocomplete` β€” refine how an `` field behaves, validates, and presents itself. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **value** β€” sets an initial (default) value for the input field. [S1] - **readonly vs disabled** β€” `readonly` blocks editing but the value is still selectable, copyable, and submitted; `disabled` makes the field unusable, unclickable, and its value is **not** submitted. [S1] - **size** β€” sets the visible width in characters (default 20). [S1] - **maxlength** β€” caps the number of characters; the browser gives no feedback when the limit is reached. [S1] - **min / max** β€” set the minimum and maximum allowed value for numeric and date/time inputs. [S1] - **multiple** β€” allows entering more than one value (works with `email` and `file`). [S1] - **pattern** β€” validates the value against a regular expression. [S1] - **placeholder** β€” shows a hint inside the field before the user types. [S1] - **required** β€” the field must be filled out before submission. [S1] - **step** β€” defines the legal number intervals. [S1] - **autofocus** β€” focuses the field automatically on page load. [S1] - **height / width** β€” set dimensions for ``; recommended to reserve layout space. [S1] - **list** β€” references a `` that supplies predefined options. [S1] - **autocomplete** β€” turns the browser's value-prediction on or off. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Default value pattern** β€” `value="..."` pre-fills the field. [S1] - **Lock-but-submit pattern** β€” `readonly` keeps a value visible and submittable while preventing edits. [S1] - **Lock-and-drop pattern** β€” `disabled` greys out a field and excludes its value from submission. [S1] - **Regex validation pattern** β€” `pattern="[A-Za-z]{3}"` enforces format on submit. [S1] - **Datalist autocomplete pattern** β€” `` + `` gives a typeahead of options. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) **The value attribute** β€” specifies an initial value for an input field: [S1] ```html ``` **The readonly attribute** β€” specifies that the input field is read-only; it cannot be modified, but the user can still highlight and copy the text, and the value is sent when the form is submitted: [S1] ```html ``` **The disabled attribute** β€” specifies that the input field is disabled. A disabled field is unusable and un-clickable, and its value will **not** be sent when submitting the form: [S1] ```html ``` **The size attribute** β€” specifies the visible width, in characters, of an input field. The default value is 20. It works with `text`, `search`, `tel`, `url`, `email`, and `password`: [S1] ```html ``` **The maxlength attribute** β€” specifies the maximum number of characters allowed. Once reached, no more input is accepted, and the browser provides no feedback; use JavaScript for a message if needed: [S1] ```html ``` **The min and max attributes** β€” specify the minimum and maximum values for input fields of type `number`, `range`, `date`, `datetime-local`, `month`, `time`, and `week`: [S1] ```html ``` **The multiple attribute** β€” specifies that the user is allowed to enter more than one value. It works with `email` and `file` input types: [S1] ```html ``` **The pattern attribute** β€” specifies a regular expression the input's value is checked against. It works with `text`, `date`, `search`, `url`, `tel`, `email`, and `password`: [S1] ```html ``` **The placeholder attribute** β€” specifies a short hint describing the expected value, shown before the user enters a value. It works with `text`, `search`, `url`, `number`, `tel`, `email`, and `password`: [S1] ```html ``` **The required attribute** β€” specifies that the input field must be filled out before submitting the form. It works with `text`, `search`, `url`, `tel`, `email`, `password`, date pickers, `number`, `checkbox`, `radio`, and `file`: [S1] ```html ``` **The step attribute** β€” specifies the legal number intervals for an input field (e.g. `step="3"` allows ..., -3, 0, 3, 6, ...). It works with `number`, `range`, `date`, `datetime-local`, `month`, `time`, and `week`: [S1] ```html ``` **The autofocus attribute** β€” specifies that the input field should automatically get focus when the page loads: [S1] ```html ``` **The height and width attributes** β€” specify the height and width of an `` element. It is recommended to always specify both so the browser can reserve the right amount of space before the image loads (preventing layout flicker): [S1] ```html ``` **The list attribute** β€” refers to a `` element that contains pre-defined options for an ``: [S1] ```html ``` **The autocomplete attribute** β€” specifies whether a form or input field should have autocomplete on or off. When on, the browser automatically completes values based on values the user entered before. It works with `
` and the input types `text`, `search`, `url`, `tel`, `email`, `password`, date pickers, `range`, and `color`. [S1] **Note:** Input restrictions are not foolproof; users can bypass the HTML, so always validate input on the server as well. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) The examples above are the canonical applied uses: a prefilled name (`value`), a copy-only field (`readonly`), a 4-digit PIN (`maxlength`/`size`), a regex-validated country code (`pattern`), a multi-file upload (`multiple`), and a browser typeahead (`list` + ``). No external project/commit applications found in the source. ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Required + placeholder field (HTML): ```html ``` Datalist typeahead (HTML): ```html ``` Bounded numeric step (HTML): ```html ``` ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) No contradictions found in the source. The key conceptual subtlety is `readonly` vs `disabled`: both prevent edits, but only `readonly` submits its value and allows selection/copy β€” `disabled` drops the value entirely. [S1] ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual (μ‹€μ œ 적용 사둀 발견 μ‹œ applied/validated둜 승격 κ°€λŠ₯) - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[HTML Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[HTML Input Types]], [[HTML Input Form Attributes]], [[HTML Forms]], [[HTML Form Elements]] - **μ°Έμ‘° λ§₯락:** Referenced when configuring validation, defaults, and UX behavior of individual form fields. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” HTML Input Attributes β€” https://www.w3schools.com/html/html_form_attributes.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-06-23: Initial draft synthesized from the W3Schools "HTML Input Attributes" page (Astra wiki-curation, P-Reinforce v3.1 format).