d3.select(inputEl).attr('value', something)
won't seem to work after the user has modified the contents of the input.
Reason: value
attribute sets the default value of the input. In order to set the value, use the value
property, use: d3.select(inputEl).property('value', something)
TODO: add demos
- In vanilla JS + d3 environment
- Compare with an example in React:
value
vsdefaultValue
- More on attributes vs properties of HTML elements?