im using a simple text input form. and the "value" is a default.. such as saying "title" in the title text feild to let users know this is where you enter your title. How can i make this default text disappear when a user clicks in text box to make an entry w/o having to backspace the text out? I see this effect all over the net. any ideas?
fuston05
0
Junior Poster in Training
Recommended Answers
Jump to Post<script type="text/javascript"> function setValue(field) { if(''!=field.defaultValue) { if(field.value==field.defaultValue) { field.value=''; } else if(''==field.value) { field.value=field.defaultValue; } } } </script> <input type="text" value="Enter Title" onfocus="setValue(this)" onblur="setValue(this)"/>
Jump to Postfor textarea, try innerHTML instead of value. You may have to work with the function a bit to get what you need, but the idea is to change the innerHTML content of the text area as it does not use the value field.
All 6 Replies
hielo
65
Veteran Poster
fuston05
0
Junior Poster in Training
SolidSolutions
13
Junior Poster
hielo
65
Veteran Poster
fuston05
0
Junior Poster in Training
fuston05
0
Junior Poster in Training
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.