Created
March 7, 2014 07:47
-
-
Save vsbarba/9407166 to your computer and use it in GitHub Desktop.
jQuery Datepicker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css"> | |
| <script src="//code.jquery.com/jquery-1.9.1.js"></script> | |
| <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script> | |
| <link rel="stylesheet" href="/resources/demos/style.css"> | |
| </head> | |
| <script> | |
| $(function () { | |
| $("#datepicker").datepicker({ | |
| dateFormat: 'yy-mm-dd', | |
| onSelect: function (date) { | |
| console.log('hello'); | |
| var actualDate = new Date(date); | |
| var datePlusOneDay = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate() + 1); | |
| var datePlusSevenDays = new Date(actualDate.getFullYear(), actualDate.getMonth(), actualDate.getDate() + 7); | |
| $('#datepicker2').val(datePlusOneDay.getFullYear() + '-' + datePlusOneDay.getMonth() + '-' + datePlusOneDay.getDate()); | |
| $('#datepicker3').val(datePlusSevenDays.getFullYear() + '-' + datePlusSevenDays.getMonth() + '-' + datePlusSevenDays.getDate()); | |
| } | |
| }); | |
| }); | |
| </script> | |
| <body> | |
| <p>Date: | |
| <input type="text" id="datepicker"> | |
| </p> | |
| <p>Date: | |
| <input type="text" id="datepicker2"> | |
| </p> | |
| <p>Date: | |
| <input type="text" id="datepicker3"> | |
| </p> | |
| </body> | |
| </html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment