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

Asked 1 years ago, Updated 1 years ago, 69 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.