Unable to use multiple datepicker instances
Hi,
I've been unsuccessfully trying to get the datepicker to work on multiple instances on the same form.
Head:
- <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
-
- <script>
- $(document).ready(function() {
- $("#datepicker").datepicker();
-
- });
- </script>
Form:
- <label for="dob">Date of Birth <span class="redstar">*</span></label>
- <span id="sprytextfield5">
- <input type="text" name="dob" id="datepicker" placeholder="mm/dd/yyyy" />
- <span class="textfieldRequiredMsg">Required.</span><span class="textfieldInvalidFormatMsg">Invalid.</span></span>
- <label for="start_date">Available start date <span class="redstar">*</span></label>
- <span id="sprytextfield5">
- <input type="text" name="start_date" id="datepicker" placeholder="mm/dd/yyyy" />
- <span class="textfieldRequiredMsg">Required.</span><span class="textfieldInvalidFormatMsg">Invalid.</span></span>
Also, I realise that I cannot have two same ids on the same page. But the datepicker doesn't work when I use the class. I'm a newbie, any help is greatly appreciated.
Thanks.
Sohail