This question is a follow-up to this one: polymer focus() on <paper-input> or <core-input> element
How can I focus in a paper-input
element using the Javascript API ?
(using Polymer 1.0)
This question is a follow-up to this one: polymer focus() on <paper-input> or <core-input> element
How can I focus in a paper-input
element using the Javascript API ?
(using Polymer 1.0)
Share Improve this question edited Jun 9, 2017 at 4:25 Max 1,0601 gold badge12 silver badges20 bronze badges asked Jun 12, 2015 at 14:01 vdegennevdegenne 13.3k16 gold badges84 silver badges115 bronze badges2 Answers
Reset to default 12If you have an element:
<paper-input id="my-input" label="What's on your mind?"></paper-input>
paper-input is a wrapper for business logic and stylish of a more deep-down input
element which you can reach through:
document.getElementById('my-input').$.input
To focus, just write:
document.getElementById('my-input').$.input.focus();
<paper-input autofocus></paper-input>
will automatically focus immediately, or if you'd prefer to control the timing yourself in Javascript you can use paperInput.$.input.focus()
.