Dave's Brain

Browse - programming tips - jquery datepicker example

Date: 2009apr21
Language: javaScript

Q.  How do I use the jQuery datepicker plugin?

A.  Here's a compact example:

<form>
<input id=date name=date size=10 readonly=readonly>
<!-- Use readonly so the user can not type the data but clicking will
make a popup -->
</form>

<script src=js/jquery.js></script>
<script src=js/ui.core.js></script>
<script src=js/ui.datepicker.js></script>
<link rel=stylesheet href=css/ui.all.css type=text/css>
<script type="text/javaScript">
$(document).ready(function() {
        $('#date').datepicker({ dateFormat: 'yy-mm-dd' });
});
</script>

A second example.  You can use <span> instead of <input type=text>
like this:

	<span id=date>Select a date</span>
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: