Hi,

How do I change the value for a field in my form when sombody clicks in that field?

for example i have a field for "name" and it should say "name" in it, but when you click in it the value changes to nothing.

Thanks,

Max Mumford.

Recommended Answers

All 2 Replies

<input type="text" name="txt" id="txt" value="Name" 
onblur="if(this.value.length == 0) this.value='Name';" onclick="if(this.value == 'Name') this.value='';" />

great, works a treat, thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.