Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to disable previous dates in datepicker using JS?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 5.15k
    Comment on it

    Here the problem is you want to show the passed dates but make them disabled.

          jQuery(document).ready(function() {
          $('#sandbox-container').datepicker({
    format: "dd/mm/yyyy",
    clearBtn: true,
    minDate: 0,
    maxDate: "+1M +10D",
    daysOfWeekDisabled: "0,6"
    });
    });
    

    What i've done with code is by using maxDate it will promt user to fill next 1month and 10day but using daysOfWeeekDisabled its keeping disabled the days passed.

    And your html code will be like

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"/></script>
    <link rel="stylesheet" ref="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
    < script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
    

    Date :

    <input id="sandbox-container" type="text">
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: