简体   繁体   中英

How to disable the future date in the jquery datepicker

I tried to disable the future date in date picker but thing is it has been disable the month and the year.

following is the code.

    <html>
<head>
    <title>Week Calculation</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/jquery-ui.css" />

    <script src="JavaScript/jquery-1.10.2.js"></script>
    <script src="JavaScript/jquery-ui.js"></script>

</head>
<body>
    <form id="daterange">
        <p>Date1: <input type="text" id="datepicker1" name="date1"></p>
        <p>Date2: <input type="text" id="datepicker2" name="date2"></p>
      <p> <label> Enter search Text: </label> <input type="text" id="byrange" name="searchText"> </p>
        <p> <input type="submit" /></p>
    </form>
</body>

在此处输入图片说明

use

$("#datepicker").datepicker({ maxDate: new Date);

or

 $("#datepicker").datepicker({  maxDate: '0'});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM