Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The difference between html element attribute and property (focus specifically on input) #34

Open
shreshthmohan opened this issue Apr 11, 2022 · 0 comments

Comments

@shreshthmohan
Copy link
Owner

shreshthmohan commented Apr 11, 2022

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

  1. In vanilla JS + d3 environment
  2. Compare with an example in React: value vs defaultValue
  3. More on attributes vs properties of HTML elements?
@shreshthmohan shreshthmohan added the draft A blog post that is a draft label Apr 11, 2022
@shreshthmohan shreshthmohan added status:published and removed draft A blog post that is a draft labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant