DEV Community

John Peters
John Peters

Posted on Edited 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)