I am trying to ensure that the content of the HTML text box is fully selected by onFocus.
I know a simple solution for placing onfocus="this.select()"on a component, but this is not a good solution, because if a user double-clicks on an area, then the choice is lost, and in browsers such as chrome, it rarely works as it should, and simply returns to form input.
I searched on Google for a while and cannot find a good solution, most of the suggestions are for this simple solution.
I would like the selection inside the text box not to change after it is selected, and if possible, the user should not edit the text in the text box, for example, if you used AdSense when you grab the code from AdSense, the selection never changes, and you cannot change the code in the text box.
Any solutions would be appreciated.
source
share