javascript - jQuery date picker - Disable dates after the selection from the first date picker -
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui datepicker - default functionality</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css"> <script> $(function () { $("#datepicker1").datepicker(); }); </script> <script> $(function () { $("#datepicker2").datepicker(); }); </script> </head> <body> <p>date 1: <input type="text" id="datepicker1"></p> <p>date 2: <input type="text" id="datepicker2"></p> </body> </html>
there 2 date pickers in code here. want disable dates when select date first date picker. suppose if select date 15/01/2015
first date picker. in second date picker dates after 15/01/2015
disabled. dates before 15/01/2015
enabled in second date picker.
how can that?
you can use maxdate option
$(function () { $("#datepicker1").datepicker().change(function () { $("#datepicker2").datepicker('option', 'maxdate', $(this).datepicker('getdate')); }); $("#datepicker2").datepicker(); });
demo: fiddle
Comments
Post a Comment