Search code examples
javascriptpolymerpolymer-1.0html-input

Highlight Text Programmatically in Polymer Paper Input


I have several polymer paper-input elements on a polymer app. When one of these elements is focused, I'd like the text input of the input be highlighted (like this) so that if a user just starts typing, the existing value of the input is overwritten.

Is there a way to highlight the text programmatically on focus?


Solution

  • I figured it out.

    inputElement.$.input.select()
    

    Would be nice if this were documented somewhere.