Skip to main content

no-refer-to-non-existent-id

Check whether the ID or the list of ID specified to for, form, aria-*, and more are referencing an ID that exists in the same document.

A hyperlink fragment (<a href="#…"> / <area href="#…">) is no-broken-fragment-link's concern, not this rule's — split out because HTML LS does not treat a broken fragment link as a conformance violation, unlike the DOMID-typed attributes and ARIA ID references this rule covers.

❌ Examples of incorrect code for this rule

<label for="foo">Text Field</label><input id="bar" type="text" />

✅ Examples of correct code for this rule

<label for="foo">Text Field</label><input id="foo" type="text" />

Interface

{
"no-refer-to-non-existent-id": boolean
}

Options

{
"no-refer-to-non-existent-id": {
"options": {
"ariaVersion"?: "1.1" | "1.2" | "1.3"
}
}
}
PropertyTypeDefault ValueDescription
ariaVersion"1.1" | "1.2" | "1.3""1.3"Choose the version of WAI-ARIA to evaluate.

Default Severity

error