Reputation: 1219
I've got disabled form field by default and when user clicks on button Edit
, it will enable the field. I also want to set focus on the field, but I don't know how. I've created ref
to the field and tried some focus()
function on it, but it hasn't worked. You can try it here on sandbox.
Upvotes: 1
Views: 7719
Reputation: 588
just HTML's autofocus
is much better:
https://davidwalsh.name/autofocus
autoFocus
Upvotes: 3
Reputation: 24276
https://codesandbox.io/s/rlx390xn6m
Upvotes: 3