# Perspective: How can I focus on a text field with the text cursor so that you don't need to click on it before typing?

**URL:** <https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [August 14, 2023, 12:22pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804 "2023-08-14T12:22:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christy\_Jean](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Christy\_Jean](https://forum.inductiveautomation.com/u/Christy_Jean)\
**Post date:** [August 14, 2023, 12:22pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/1 "2023-08-14T12:22:42Z")

</div>

The text field is initially hidden, but after a button click I'd like to have the text field become visible with the text cursor.

---

<div class="post-metadata">

**Author:** ![victordcq](https://avatars.discourse-cdn.com/v4/letter/v/f6c823/32.png) [@victordcq](https://forum.inductiveautomation.com/u/victordcq)\
**Post date:** [August 14, 2023, 12:24pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/2 "2023-08-14T12:24:54Z")

</div>

you can call focus on the component  
`.focus()`

---

<div class="post-metadata">

**Author:** ![Christy\_Jean](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Christy\_Jean](https://forum.inductiveautomation.com/u/Christy_Jean)\
**Post date:** [August 14, 2023, 12:28pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/3 "2023-08-14T12:28:13Z")

</div>

tried this but I still need to click the text field before I can type

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [August 14, 2023, 5:53pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/5 "2023-08-14T17:53:56Z")

</div>

Are we certain you're using a component that has the .focus() method?

> **[Perspective Component Methods | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/scripting-in-perspective/perspective-component-methods#requesting-focus)**
>
> A component method is a function that is defined on a component object. For example, this is how we would call a component method defined on the component object self:

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 14, 2023, 6:45pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/6 "2023-08-14T18:45:51Z")

</div>

But _where_ are you doing this? Could you please share the code which changes the display state of the component in conjunction with the code which requests focus on that component?

---

<div class="post-metadata">

**Author:** ![Christy\_Jean](https://avatars.discourse-cdn.com/v4/letter/c/977dab/32.png) [@Christy\_Jean](https://forum.inductiveautomation.com/u/Christy_Jean)\
**Post date:** [August 14, 2023, 8:03pm UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/7 "2023-08-14T20:03:24Z")

</div>

I got it to work but I noticed when I used a barcode scanner, the cursor would disappear from the text field after whatever is scanned is inputted

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 15, 2023, 2:13am UTC](https://forum.inductiveautomation.com/t/perspective-how-can-i-focus-on-a-text-field-with-the-text-cursor-so-that-you-dont-need-to-click-on-it-before-typing/77804/8 "2023-08-15T02:13:46Z")

</div>

Probably because the Barcode Scanner is requesting focus.
