Jquery - Datepicker. Select the date range to search for.


SUBMITTED BY: jlolk3r

DATE: Feb. 5, 2016, 3:05 a.m.

FORMAT: HTML

SIZE: 1.1 kB

HITS: 2212

  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Datepicker - Select a Date Range</title>
  6. <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  7. <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  8. <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  9. <link rel="stylesheet" href="/resources/demos/style.css">
  10. <script>
  11. $(function() {
  12. $( "#from" ).datepicker({
  13. defaultDate: "+1w",
  14. changeMonth: true,
  15. numberOfMonths: 3,
  16. onClose: function( selectedDate ) {
  17. $( "#to" ).datepicker( "option", "minDate", selectedDate );
  18. }
  19. });
  20. $( "#to" ).datepicker({
  21. defaultDate: "+1w",
  22. changeMonth: true,
  23. numberOfMonths: 3,
  24. onClose: function( selectedDate ) {
  25. $( "#from" ).datepicker( "option", "maxDate", selectedDate );
  26. }
  27. });
  28. });
  29. </script>
  30. </head>
  31. <body>
  32. <label for="from">From</label>
  33. <input type="text" id="from" name="from">
  34. <label for="to">to</label>
  35. <input type="text" id="to" name="to">
  36. </body>
  37. </html>

comments powered by Disqus