Thursday, 29 January 2015

Selecting the text in textbox when user clicks it


To select the all text you can use the following javascript snippet:

onClick="this.select();"

But it doesn't work on mobile Safari. In those cases you can use:


onClick="this.setSelectionRange(0, this.value.length);"

No comments:

Post a Comment