4 ms·
Hmmm, yeah I suppose that's true when using the `value` attribute, EDIT: ignore the below. It was pointed out I misinterpreted defaultValue. but there's actua
by culi 4y ago
Hmmm, yeah I suppose that's true when using the `value` attribute,
EDIT: ignore the below. It was pointed out I misinterpreted defaultValue.
but there's actually also a `defaultValue` attribute which I believe behaves how you would like it to:
https://caniuse.com/mdn-api_htmlinputelement_defaultvalue https://caniuse.com/mdn-api_htmlinputelement_defaultvalue
Ofc you can also use JS to make sure an input has been blurred or touched to pass validation on submit
- eurleif 4y agoThat's not what `defaultValue` does. `defaultValue` is a JS (not HTML) attribute which simply allows you to retrieve the original value set in the HTML. So if you have this HTML: <input id="foo" value="bar"> Then `document.getElementById('foo').defaultValue` will always return `'bar'`, even if the user has edited the value in the field.
- culi 4y agoYou're right, thanks for the correction. Then yeah I suppose it'd have to be a javascript trick that sets the default value when the calendar is opened or, as GP suggested, something done at the standards or implementation level