DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 967,611 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
John Peters
John Peters

Posted on • Updated on

Html Input onclick select text

When users click on an input with text already there, this is the easiest way to pre-select the text for them.

 <input  
  type="text"
  onclick="this.select()" 
 />
Enter fullscreen mode Exit fullscreen mode

Not too difficult except when trying to remember Angular conventions like (click), [(click)],(onClick) etc. No Angular needed...

Top comments (0)

Have you saved a post on DEV?

Head to your Reading List to read and manage the posts you've saved.