Open Source Tutorials - Open Source Training
Open source training & tutorials from experienced, passionate people
chrome icon firefox icon ie icon opera icon safari icon Sings in these Browsers
A- A A+

By A Web Design

Welcome, Guest
Username Password: Remember me

Javascript "watermarks" for textboxes
(1 viewing) (1) Guest
All your queries regarding JavaScript will be solved in this forum
  • Page:
  • 1
TOPIC:

Javascript "watermarks" for textboxes

Javascript "watermarks" for textboxes 1 year, 4 months ago #455

  • abott
  • OFFLINE
  • Junior Boarder
  • Posts: 25
  • Karma: 0
I would like to know how to put text in a textbox when the page loads. Example: If I have a page with labels and inputs, from that i would have two textboxes named "Start Date" and "End Date". When the page loads I want the the textbox to load with "dd/mm/yyyy" written inside, so I won't have to put a label for that outside. But when the user clicks inside textbox it should disppear. How do I do this?

Re: Javascript "watermarks" for textboxes 1 year, 4 months ago #472

  • patrica
  • OFFLINE
  • Junior Boarder
  • Posts: 28
  • Karma: 0
Javascript "watermarks" for textboxes can be done as shown in the following example

<input name="txtDate" on-focus="if (this.value=='dd/mm/yyyy') this.value = ''" type="text" value="dd/mm/yyyy">
  • Page:
  • 1
Time to create page: 1.06 seconds
OSV Newsletter


Receive HTML?

NOTE: To prevent subscription to the OSV newsletter, uncheck the checkbox above.
Guest Blog for OSV
Free Ebook Download