“How to automatically focus and highlight the text in an input” is a question that gets asked pretty frequently here on the Bubble forums. It’s not something natively handled by Bubble at this time. It’s a useful thing to do, though, because it allows your users to just start typing without having to first clear an input’s initial value.
I just figured out how to do this for my own app and I thought I’d share it here because it’s working so well for me:
Step 2: In your app’s settings on the General tab you’ll need to turn on the “Expose the option to add an ID attribute to HTML elements”
const input = document.getElementById('YOUR_INPUT_ID_GOES_HERE'); input.focus(); input.select();
I hope you found this to be a handy tip! Please let me know if it works for you, too.