Saturday, April 19, 2014

Disable previous date in date picker using jQuery

In this post we will discuss about hide previous dates using jQuery.

Before this we need to add library files and CSS files.

minDate is used to hide previous dates.If we set minDate:0 it will hide previous dates.



Demo

Date:

jQuery Files

      <link href="http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" rel="Stylesheet" type="text/css" />
      <script src="http://code.jquery.com/jquery-2.0.2.min.js" language="javascript"></script>
      <script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
      <script language="javascript">
    $(document).ready(function () {
        $("#previousdate").datepicker({
            minDate: 0 // this is used to hide previous date.
        });
    });
</script>
   

HTML code

 Date:       <input id="previousdate" type="text" class="Datepicker">
    

No comments:

Post a Comment