Wednesday, March 4, 2009

How to create a popup DatePicker for a text box using jQuery

For this we can use a very nice widget created by jQuery.
First we will download the datepicker widget from the site
http://jqueryui.com/download

Only select the Datepicker widget to download


After downloading the zip file, extract the files into a folder called jquery.


<html>
<head>
<title>jQuery UI Datepicker - Default functionality</title>

<link type="text/css" href="jquery/theme/ui.all.css" rel="Stylesheet" />
<script type="text/javascript" src="jquery/jquery-1.3.1.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-personalized-1.6rc6.js"></script>

<script type="text/javascript">
$(function() {
$("#datepicker").datepicker();
});
</script>
</head>
<body>

<p>Date: <input type="text" id="datepicker"></p>

</body>
</html>




You can read more about this Datepicker from here.
http://jqueryui.com/demos/datepicker/

No comments:

Post a Comment