2 ms·
> Attributes with spaces require quotes around the value. It's meant to be read/parsed as `type="checkbox"`, `switch="true"`, `checked="true"`, `class="special
by abdusco 3y ago
> Attributes with spaces require quotes around the value.
It's meant to be read/parsed as `type="checkbox"`, `switch="true"`, `checked="true"`, `class="special"`. They're different attributes, not a long `type` attribute without quotes.
- sublinear 3y ago> checked="true" https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/checkbox https://developer.mozilla.org/en-US/docs/Web/HTML/Element/in... That's not how the value of the checked attribute works. It's already messed up enough. > The value attribute is one which all <input>s share; however, it serves a special purpose for inputs of type checkbox: when a form is submitted, only checkboxes which are currently checked are submitted to the server, and the reported value is the value of the value attribute. If the value is not otherwise specified, it is the string "on" by default.
- vidarh 3y ago> That's not how the value of the checked attribute works. It is roughly/conceptually how the "checked" attribute works, in that boolean attributes provided by name but without a value will be set/truthy. From the link you gave: > checked > A boolean attribute indicating whether this checkbox is checked by default (when the page loads). What you quoted is how the "value" attribute works, which is entirely irrelevant to how the "checked" attribute works.
- domenicd 3y agoAlmost, it's `switch=""`, `checked=""`.
- Izkata 3y agoConvention used to be checked="checked"