1

I want to set maximum limit in JQuery Datepicker so that the user can't pick date after current date. Currently I'm using http://jqueryui.com/datepicker/ plugin. How to set maximum limit in JQuery datepicker ?

4 Answers4

1

you can validate by Jquery

$(document).ready(function(){
  if($("#datepicker").val() == ''){
  alert("Please Select Your date");
  }
});
ankit singh
  • 367
  • 1
  • 3
  • 13
1

try this- just in the datepicker function you are using pass these parameters

$("#date").datepicker({
    onSelect: function(selectedDate) {
         $( "#date1" ).datepicker( "option", "maxDate", selectedDate);
    }
});
sunny
  • 1,156
  • 8
  • 15
0

Try

option-maxDate

Working Demo

$("#date").datepicker("option","maxDate",0);

or

$("#date").datepicker("option","maxDate",new Date());


Working Demo
$(function () {
    $("#date").datepicker({
        maxDate: 0
    });
});
Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
0
$("#date").datepicker({
      dateFormat: 'dd/mm/yy',
      minDate: 0,
      maxDate: "+30M",   
    });

fore more look here

Community
  • 1
  • 1
chriz
  • 1,339
  • 2
  • 16
  • 32