Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <input class="datepicker begin" type="text" />
  <input class="datepicker end" type="text"/>
  <script>
    $(function () {
        $(".datepicker.begin").datepicker({
            minDate: '+2d',
            maxDate: '+2y',
            onSelect: function(dateText, inst) {
               // Resolve the current date
               var begin = new Date($(this).val());
               var d = begin.getDate();
               var m = begin.getMonth();
               var y = begin.getFullYear();
               // Update your target date
               $(".datepicker.end").datepicker('setDate', new Date(y, m, d+2));
               $(".datepicker.end").datepicker( "option", "minDate", begin);
            }
        });
        $(".datepicker.end").datepicker({
            minDate: '+4d',
            maxDate: '+2y'
        });
    });
  </script>
    
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
rionmonsterpro
0viewers