jquery - Stop JqueryUI Datepicker Months Navigation After A particular Year Ends -
i have used jqueryui datepicker, have add list of holidays particular year.
is there way disable datepicker's month navigation after particuler year ends?
eg. if adding holidays list year 2014, want disable datepicker's prev month navigation (prev button) when january 2014 month selected. , if december 2014 month selected, want disable next month navigation button(next button). further not want use changeyear/changemonth options on datepicker.
my code is:
$(document).ready(function () { $("#txtholidaydate").datepicker( { dateformat: 'dd/mm/yy' }); });
thanks,
i have made jsfiddle restrict date range year entered user. check out !
html:
<h3>currently dates restricted year 2014</h3> enter year restrict date range to: <input type="text" id="year" size="30" value="2014"/> <input type="button" id="change_year" value="change year"> <br> date: <input type="text" id="datepicker" />
js:
$(function() { var year_val = 2014; $( "#datepicker" ).datepicker({ mindate: new date(year_val, 1 - 1, 1), maxdate: new date(year_val, 11, 31) }); $('#change_year').click(function(){ if($('#year').val() != "") { year_val = $('#year').val(); $( "#datepicker" ).datepicker( "option", "mindate", new date(year_val, 1 - 1, 1) ); $( "#datepicker" ).datepicker( "option", "maxdate", new date(year_val, 11, 31) ); } }); });
Comments
Post a Comment