# onSetFocus clear text all the time

**URL:** <https://forum.kirupa.com/t/onsetfocus-clear-text-all-the-time/250916>\
**Category:** Uncategorized\
**Created:** [February 3, 2008, 11:47am UTC](https://forum.kirupa.com/t/onsetfocus-clear-text-all-the-time/250916 "2008-02-03T11:47:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossarian](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yossarian](https://forum.kirupa.com/u/yossarian)\
**Post date:** [February 3, 2008, 11:47am UTC](https://forum.kirupa.com/t/onsetfocus-clear-text-all-the-time/250916/1 "2008-02-03T11:47:36Z")

</div>

Hi,

I’ve got a number of input text boxes which text is cleared when users click them. That works well although my code is a bit ‘much’ ( I know…). However, the text is cleared if the user wishes to edit their text as well. How can I create a function so that the text is cleared once but not if they want to edit their own text?

```
ActionScript Code:
[FONT=Courier New][LEFT]box1.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]"Your title here"[/COLOR];

```

box1.[COLOR=#0000FF]onSetFocus[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
box1.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]""[/COLOR];  
[COLOR=#000000]}[/COLOR];

box3.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]“Your label here”[/COLOR];  
box3.[COLOR=#0000FF]onSetFocus[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
box3.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]""[/COLOR];  
[COLOR=#000000]}[/COLOR];

box4.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]“Your label here”[/COLOR];  
box4.[COLOR=#0000FF]onSetFocus[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
box4.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]""[/COLOR];  
[COLOR=#000000]}[/COLOR];

box5.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]“Your label here”[/COLOR];  
box5.[COLOR=#0000FF]onSetFocus[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
box5.[COLOR=#0000FF]text[/COLOR] = [COLOR=#FF0000]""[/COLOR];  
[COLOR=#000000]}[/COLOR];  
[/LEFT]  
[/FONT]

Your help is much appreciated.
