Dave's Brain

Browse - Programming Tips - How do I use the jQuery datepicker plugin?

Date: 2009apr21
Language: javaScript
Warning: html5 has <input type=date ...>
Keywords: date, pick, picker

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>

Add a comment

Sign in to add a comment
Copyright © 2008-2018, 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.