Inspect the working example
The first input deliberately contains the invalid boolean spelling disabled="false". Browsers still treat disabled as present. The second input has no disabled attribute and is editable. This is a repair lesson, not a recommended way to serialize a boolean.
| Case | Input or inspection | Result and meaning |
|---|---|---|
| Present with false text | Inspect frozen.hasAttribute("disabled") | True; frozen.disabled=true; effective state disabled |
| Absent | Inspect editable.hasAttribute("disabled") | False; editable.disabled=false; it is editable |
| Repair | Remove disabled from frozen | Its disabled property becomes false |
Follow the browser mechanism
For an HTML boolean attribute, presence represents true and absence represents false. Valid authoring uses an empty value or the attribute’s name, rather than the strings true or false. Do not insert disabled="false" when a template flag is false; omit disabled entirely. This fixture has no disabled ancestor, so absence also makes this input effectively enabled.
An empty boolean value is still true
Changing false to an empty string does not remove the attribute. This correctly spelled boolean attribute still expresses the disabled state.
<label>Sample <input id="frozen" type="text" disabled="" value="A"></label>hasAttribute("disabled") remains true and disabled remains true. The successful repair removes the attribute, not its text alone.
Try the repair
Your template flag is false. Should its HTML output be disabled="false", disabled="", or no disabled attribute?
Show the worked answer
Omit the disabled attribute. Both written forms leave the attribute present and the field disabled in this fixture.
- Test hasAttribute and effective interaction after the repair.
- Check ancestor fieldsets separately when interpreting enabled state.