Skip to content

How to programmatically focus a TextField? #1594

Closed
@mewben

Description

@mewben

StackOverflow: https://stackoverflow.com/questions/37949394/how-to-set-focus-to-a-materialui-textfield/44587705#44587705

Expand I have this textfield:

<TextField ref="item" />

I want to focus this textfield when I click a button. I have this

React.findDOMNode(this.refs.item).focus();

but it doesn't work.

I tried using a simple <input type="text" ref="item" /> and there's no problem with it.

Please help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: text fieldThis is the name of the generic UI component, not the React module!support: questionCommunity support but can be turned into an improvement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions