Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Select All" on clicking Bootstrap input

Let's say i have this input:

  <li><input type="text" id="elementHeight" class="form-control" placeholder="Height"> </li>

and i want to ''Select All'' in the input field when the user clicks on it.

like image 429
nicholaswmin Avatar asked Feb 23 '14 11:02

nicholaswmin


Video Answer


1 Answers

From a similar question, I got an answer I prefer.

<input type="text" onfocus="this.select();" onmouseup="return false;" />

Source: https://stackoverflow.com/a/480756/989227

like image 116
santiaago Avatar answered Nov 15 '22 07:11

santiaago