Tip #11 Auto select input text on focus

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>
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.