Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
187
rated 0 times [  191] [ 4]  / answers: 1 / hits: 72293  / 13 Years ago, wed, march 16, 2011, 12:00:00

I want to clear the text field when the user clicks on that



<input name=name type=text id=input1 size=30 maxlength=1000 value=Enter Postcode or Area onfocus==this.value='' />


More From » html

 Answers
14

To do this you will need to use a scripting language, probably javascript. Here an example



<input type='text' value'Some text' onclick='javascript: this.value = ' />


Hope this helps.



Edit:



To meet what David is explain here is a second example in case that is what you are looking for



<script type='javascript'>
var clear = true;
function clear(obj)
{
if(clear)
{
obj.value = '';
clear = false;
}
}
</script>

<input type='text' value'Some text' onfocus='clear(this);' />

[#93254] Tuesday, March 15, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tristab

Total Points: 735
Total Questions: 106
Total Answers: 96

Location: Grenada
Member since Sun, Dec 20, 2020
3 Years ago
tristab questions
Sat, Sep 25, 21, 00:00, 3 Years ago
Sun, Jan 31, 21, 00:00, 3 Years ago
Wed, Dec 2, 20, 00:00, 4 Years ago
Fri, Oct 23, 20, 00:00, 4 Years ago
;