Tip #11 Auto select input text on focus
Published in
1 min readMar 23, 2017
Sometimes you simply don't need a directive, plugin or custom component.
Do you want to select the input content when clicked, like github does with clone url?
Just add this code to your input:
<input @focus="$event.target.select()">
That's it! But remember, if your input is inside a component, you have to add .native to the event, like this:
<my-component @focus.native="$event.target.select()"></my-component>