It is simple.
- Loading necessary JavaScript and CSS files
<!-- Load jQuery from Google's CDN --> <!-- Load jQuery UI CSS --> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <!-- Load jQuery JS --> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <!-- Load jQuery UI Main JS --> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
- Create a form.
<p>Pick a Date: <input type="text" id="datepicker" /></p>
Here You should have a id attribute on element that date picker should appear on(Here id is "datepicker")
- Adding JavaScript
$(document).ready( /* This function will get executed after the DOM is fully loaded */ function () { $( "#datepicker" ).datepicker({ changeMonth: true,//this option for allowing user to select month datepicker: false, format: 'H:i', changeYear: false//this option for allowing user to select from year range }); } );
Check out JQuery API documentation for more features can be added with date pickers
A Demo:
Pick a Date:There are more nice time and date pickers. check out these
No comments:
Post a Comment