0

Hi Friends How to restrict user to not select previous date then the date selected before by him in same form Below is my code

HTML

<table>
<tr>
          <td align="right">Check in date</td>
          <td width="81%" style="padding:0;"><table width="100%" border="0" cellspacing="0" cellpadding="5">
            <tr>
              <td width="25%"><input type="text" name="ww" size="30" id="checkIn" class="nameBook"/></td>
              <td width="15%" align="right">Check out date*</td>
              <td width="60%"><input type="text" name="ww2" size="30" id="checkOut" class="nameBook"/></td>

            </tr>
          </table></td>
        </tr>
</table>

SCRIPT

<script>
$(document).ready(function() {
    $( "#checkIn" ).datepicker({ minDate: 0,  dateFormat: "yy-mm-dd"}); 
        var checkIn = $( "#checkIn" ).val();
        $( "#checkIn" ).on('change',function(){
             alert(checkInDate);                
        })
    $( "#checkOut" ).datepicker({ minDate: /*Not Lasser then the date which user selects in #checkIn*/ });
});
</script>

Please help me guys...

Kamal
  • 2,140
  • 8
  • 33
  • 61

1 Answers1

1

on selection you can change the mindate

onSelect: function( selectedDate ) {
    $( "#to" ).datepicker( "option", "minDate", selectedDate );
  }
Manish Singh
  • 136
  • 1