'Input with type "date" doesn't display new value
I have an input with type "date":
<input type="date" value="2016-08-16"/>
When I load the page I can see that specified date is selected.
However, if I try to select another date - 11 August 2016, for example - value in the input is not updating and is always 08/16/2016.
I'm testing page in Chrome Version 53.0.2785.116 (64-bit). Do I miss something in element declaration?
Solution 1:[1]
You need to handle input value with a variable.
let inputDate = "2021-06-18";
const handleChange = (event) => {
inputDate = event.target.value;
}
<input type="date" value=inputDate onChange={handleChange}/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | falcoleonel |