This is the working fiddle format and below is the code I used on my demo site. I created a new js folder name and placed datepicker.js inside it. so I linked the following in my html.
<script type="text/javascript" src="js/datepicker.js"></script>
and my datapicker.js code
$(function () { $('#departure-date').datepicker({ numberOfMonths: 2, showAnim: "fold", showButtonPanel: true, onSelect: (function (date) { setTimeout(function () { $('#return-date').datepicker('show'); }, 300) $(this).val($(this).datepicker('getDate').toLocaleDateString()); }) }); $('#return-date').datepicker({ numberOfMonths: 2, showAnim: "fold", showButtonPanel: true, onSelect: (function (date) { $(this).val($(this).datepicker('getDate').toLocaleDateString()); }) }); });
and my html code
<input id="departure-date" type="text" placeholder="Depart Date" > <input type="text" id="return-date" placeholder="return Date">
but when i click the above .js button is not called. please, help
javascript jquery html css
Gladwin james
source share