I wish to create a textbox watermark without using either Ajax or JavaScript. How can I do this?
Asked
Active
Viewed 1.0k times
5
-
you should accept the answer if it helped - otherwise provide some feedback. – Greg Sansom May 02 '11 at 01:15
-
Without using JS your watermark will still be present even when text has been entered. – Mitch Satchwell Oct 29 '12 at 08:36
3 Answers
7
It is very easy. In html we can give the placeholder attribute for input elements.
e.g.
<input type="text" name="fst_name" placeholder="First Name"/>
check for more details :http://www.w3schools.com/tags/att_input_placeholder.asp

apm
- 525
- 6
- 19
1
You can assign a background image with CSS like so.
textarea {
background-image: url(yourwatermarkimage);
background-attachment: scroll;
}

Loktar
- 34,764
- 7
- 90
- 104
0
I have got a dll on this site. It solved my problem http://www.dotnetcurry.com/ASPNETandjQuery/Section1-TextBox/R12-TextBoxWaterMark.aspx

Hitesh Gawhade
- 181
- 3
- 7
- 23
-
1it works well, if you are submitting the text and dont enter anything, submit wont save any text. – Hitesh Gawhade Oct 29 '12 at 08:39