How do I select all the letters there when I click input?

Asked 2 years ago, Updated 2 years ago, 80 views

<input type="text" id="userid" name="userid" value="Please enter the user ID" /> This is how we defined the input tag. Can't you make me select all the tests written here when I click on this box?

javascript html textinput

2022-09-21 23:20

1 Answers

<input onClick="this.setSelectionRange(0, this.value.length)" value="Sample Text" /> This is how you do it.


2022-09-21 23:20

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.