HTML textbox, auto highlighting text
15,352
If I've understood your problem correctly, you could use some javascript (untested code):
<script language="JavaScript">
function selectText(textField)
{
textField.focus();
textField.select();
}
</script>
<input type="text" name="sometext" size="100" value="The Text" onClick='selectText(this);'>
You can put the script between your <head> and </head> tags.
Author by
Admin
Updated on June 04, 2022Comments
-
Admin about 2 years
How would I make a textbox, containing preexisting text, that when the user clicked within it all the text inside it would become highlighted. For example, the same way YouTube does the textboxes for the embed code on their videos. Thanks