code_junkie

In search of JavaScript Month Picker

Nov 11th, 2011
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  3. <head>
  4. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.js"></script>
  5. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
  6. <link rel="stylesheet" type="text/css" media="screen" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/jquery-ui.css">
  7. <script type="text/javascript">
  8. $(function() {
  9. $('.date-picker').datepicker( {
  10. changeMonth: true,
  11. changeYear: true,
  12. showButtonPanel: true,
  13. dateFormat: 'MM yy',
  14. onClose: function(dateText, inst) {
  15. var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
  16. var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
  17. $(this).datepicker('setDate', new Date(year, month, 1));
  18. }
  19. });
  20. });
  21. </script>
  22. <style>
  23. .ui-datepicker-calendar {
  24. display: none;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <label for="startDate">Date :</label>
  30. <input name="startDate" id="startDate" class="date-picker" />
  31. </body>
  32. </html>
Add Comment
Please, Sign In to add comment