Reputation: 45
My color input appears not working/changing when declared default value (#ffffff)
But if I don't declare it, it works normally.
Keep in mind that I am on a NextJS framework.
<input
type='color'
className={styles['change-bg']} /* Some css */
value="#ffffff" /* the default value */
/>
Upvotes: 0
Views: 1063
Reputation: 51
Instead of value
attribute use defaultValue
, this will solve your problem.
The following blog is from react and refer to this link for the reason: https://reactjs.org/docs/uncontrolled-components.html#default-values
Upvotes: 2