No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Checkbox set focus programatically?

    Framework
    3
    6
    201
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • labs20
      labs20 last edited by labs20

      Hi.

      How do you set focus on checkbox programatically?

      It does not publish the deafult focus() function.

      Any hint?

      Thanks

      1 Reply Last reply Reply Quote 0
      • labs20
        labs20 last edited by

        Obs: I know that I can put it inside a field and call field.focus(), but I do not want to encapsulate it.

        metalsadman dobbel 2 Replies Last reply Reply Quote 0
        • metalsadman
          metalsadman @labs20 last edited by

          @labs20 use a ref on your checkbox maybe, and call focus on mounted with a nextTick or something like that.

          1 Reply Last reply Reply Quote 0
          • dobbel
            dobbel @labs20 last edited by dobbel

            @labs20

            Here’s an attempt. No perfect code: focus method not found so I used a private focus method , could be improved @metalsadman? :

            https://codepen.io/ontwikkelfabriek/pen/pobKPpa

            metalsadman 1 Reply Last reply Reply Quote 0
            • metalsadman
              metalsadman @dobbel last edited by 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.

              dobbel 1 Reply Last reply Reply Quote 0
              • dobbel
                dobbel @metalsadman last edited by

                @metalsadman said in Checkbox set focus programatically?:

                refs.qchkboxref.$el.focus()

                @labs20
                Yes that worked , I updated the codepen. thanks

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post