# How to: focus on input field on page load

**URL:** <https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677>\
**Category:** How do I?\
**Created:** [January 6, 2023, 8:25pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677 "2023-01-06T20:25:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![carri](https://avatars.discourse-cdn.com/v4/letter/c/c57346/32.png) [@carri](https://community.weweb.io/u/carri)\
**Post date:** [January 6, 2023, 8:25pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/1 "2023-01-06T20:25:57Z")

</div>

On authentication pages and other form only pages, I’d like to focus on the first field on page load. How might I achieve this?

---

<div class="post-metadata">

**Author:** ![Mael](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/mael/32/13246_2.png) [@Mael](https://community.weweb.io/u/Mael)\
**Post date:** [January 17, 2023, 10:23am UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/2 "2023-01-17T10:23:20Z")

</div>

You can add this attribute to the input you want to autofocus

![Screenshot 2023-01-17 at 11.22.54](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/b/b4bbdb0ed7b7b818c9c0480d627de0a47ee5093e.png)

---

<div class="post-metadata">

**Author:** ![nico](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/nico/32/12975_2.png) [@nico](https://community.weweb.io/u/nico)\
**Post date:** [February 21, 2025, 9:52pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/3 "2025-02-21T21:52:12Z")

</div>

Hello, here’s a solution (Video by Joyce)  
[Trigger the focus state of an element with a no-code workflow](https://youtu.be/7Prszczuq2k?si=KBdMX1kgP7Kn6zf9)

---

<div class="post-metadata">

**Author:** ![fynn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/fynn/32/15124_2.png) [@fynn](https://community.weweb.io/u/fynn)\
**Post date:** [February 4, 2026, 5:54pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/4 "2026-02-04T17:54:28Z")

</div>

Hello, is there a swift method to focus on an input element within a repeating list?

---

<div class="post-metadata">

**Author:** ![Joyce](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/joyce/32/13232_2.png) [@Joyce](https://community.weweb.io/u/Joyce)\
**Post date:** [February 4, 2026, 6:03pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/5 "2026-02-04T18:03:48Z")

</div>

Hey @fynn 👋

I think having the input element be a component is the most scalable way to do this.

Here’s a video on the topic: [https://youtu.be/fVhZib-MZ1A](https://youtu.be/fVhZib-MZ1A)

Let me know if it helps!

---

<div class="post-metadata">

**Author:** ![Yaj](https://avatars.discourse-cdn.com/v4/letter/y/eb8c5e/32.png) [@Yaj](https://community.weweb.io/u/Yaj)\
**Post date:** [February 4, 2026, 9:59pm UTC](https://community.weweb.io/t/how-to-focus-on-input-field-on-page-load/1677/6 "2026-02-04T21:59:39Z")

</div>

Haven’t seen it mentioned but a very simple solution is to put an ID on the element then do some custom javascript on page load to focus on the element with that id. We’ve had this in one place we needed it on our app for years with no issues.
