1. Home
  2. Computing & Technology
  3. JavaScript

Date Selector

3. Add to Your Form

clr gif
More of this Feature

Introduction The Script

To add the calendar driven date selection input field into a form doesn't involve a great deal more HTML than an ordinary input field would. Simply add the following into your form where you want the date input field to appear.

<label for="calDate">Date</label>
<input type="text" name="calDate" id="calDate" size="18" />
<div id="calendar"></div>

You may of course need to code your input field slightly differently than this (you might want to identify what sort of date it is for example). The only parts of the HTML that you can't change if you want the script to work are the two id fields. The input field that is to be loaded with the date must have an id of calDate and the empty div to hold the calendar must have an id of calendar.

Introduction | The Script | Identify Object
Explore JavaScript
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. JavaScript

©2009 About.com, a part of The New York Times Company.

All rights reserved.