Pricing Blog

How to set FOCUS on a text element?

  • patrickmast-1278000911251144764

    Patrick Mast

    1 year ago

    I have a simple project that includes only a div and a text element on the page: https://start-txtedit.toddle.site. How can I ensure that the text element gets focus when the page loads?
  • tomthebigtree-1278029253879005215

    Tom Ireland

    1 year ago

    I think you'd need to focus the div as a text element cannot have attributes. You'd need to add an id attribute with value and set tabindex to 0. On load, choose focus and use the Get element by id formula to get the div.
  • andreasmoller-1278078417618731153

    Andreas Møller

    1 year ago

    You can also set the autofocus attribute on all form elements
  • Including input and textarea
  • patrickmast-1278205867145039905

    Patrick Mast

    1 year ago

    Works, thanks! 👍