Reputation: 1270
My code is
jQuery(function() {
jQuery("#fromDatepicker").datepicker({
changeMonth : true,
changeYear : true,
dateFormat: 'mm/dd/yy'
});
});
jQuery(function() {
jQuery("#toDatepicker").datepicker({
changeMonth : true,
changeYear : true,
dateFormat: 'mm/dd/yy'
});
});
and input fields are
<input type="text" id="fromDatepicker" name="searchStartDate" size="20">
<input type="text" id="fromDatepicker" name="searchStartDate" size="20">
the calender is displaying but,
when I select a date on the calendar, the date is not selecting and not entering the date into the text field.
i am using
Upvotes: 0
Views: 1619
Reputation: 34168
You can simplify this entire thing a bit:
<input type="text" id="fromDatepicker" size="20" />
<input type="text" id="toDatepicker" size="20" />
jQuery(function() {
jQuery("#fromDatepicker, #toDatepicker").datepicker({
changeMonth: true,
changeYear: true,
dateFormat: 'mm/dd/yy'
});
});
See it in action here: http://jsfiddle.net/MarkSchultheiss/jUsTr/
By putting the comma between the selectors they are two selectors.
Upvotes: 0
Reputation: 14798
You are including the same version of jQuery twice, jquery-1.6.2.js and jquery-1.6.2.min.js. Just load the latter and this should stop some of the issues you are having.
Additionally, you have unnecessarily put the code into 2 jQuery();
calls, they could be put into one like this
jQuery(function() {
jQuery("#fromDatepicker").datepicker({
changeMonth : true,
changeYear : true,
dateFormat: 'mm/dd/yy'
});
jQuery("#toDatepicker").datepicker({
changeMonth : true,
changeYear : true,
dateFormat: 'mm/dd/yy'
});
});
Upvotes: 1