
HTML Forms and Instant Select
If you’re wondering how people create windows which contain text that gets automatically selected or highlighted when someone clicks inside the window, here’s the HTML code:
<textarea name="nameofyourtextarea" rows="4" cols="100"
readonly="readonly" id="idofyourtextarea"
class="cssforyourtextarea" onfocus="this.select()"
style="height:150px;width:300px;">
Your long text (contents of your textarea box)...
</textarea>
And there you go…
The key there is the part that says onfocus=”this.select()”
Have fun!
First posted on Sunday, 04 Jan 2009
Tags: html
« « Dayo: Animated Philippine Culture| Blog Contest: Win a Book » »
