Note: When you consider onclick="this.select()"
, At the first click, All characters will be selected, After that maybe you wanted to edit something in input and click among characters again but it will select all characters again. To fix this problem you should use onfocus
instead of onclick
.