Checkbox set focus programatically?
-
Hi.
How do you set focus on checkbox programatically?
It does not publish the deafult focus() function.
Any hint?
Thanks
-
Obs: I know that I can put it inside a field and call field.focus(), but I do not want to encapsulate it.
-
@labs20 use a ref on your checkbox maybe, and call focus on mounted with a nextTick or something like that.
-
Here’s an attempt. No perfect code: focus method not found so I used a private focus method , could be improved @metalsadman? :
-
@dobbel try refs.qchkboxref.$el.focus() or log it check on the children, and call focus on that one. Can’t post an example atm in mobile.
-
@metalsadman said in Checkbox set focus programatically?:
refs.qchkboxref.$el.focus()
@labs20
Yes that worked , I updated the codepen. thanks