I have enclosed multiple fields within div elements in order to specify them with a datepicker for a better user experience.
For example:
<div class="need-date" >
<label>Appointment Date</label>
<input id="id_appointment_date" type="text"></input>
</div>
To add a datepicker to the text box within this specific div, you can use the following script:
<script>
$(function() {
$('#id_appointment_date').datepicker({
dateFormat: 'mm-dd-yy',
changeYear: 'true',
changeMonth: 'true',
startDate: '08-24-2014',
firstDay: 1,
onSelect: function()
{
var dateObject = $(this).datepicker('getDate');
}
});
});
</script>
How can I modify this code to apply a datepicker to the text box wrapped in a specific div?