Book Image

PHP Ajax Cookbook

Book Image

PHP Ajax Cookbook

Overview of this book

Table of Contents (16 chapters)
PHP Ajax Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Improving date selection with Datepicker


A Da tepicker or calendar widget is part of any Web 2.0 website. It helps in quickly selecting dates visually and thus avoids errors in the date when a user has to input it in a particular format. The jQuery UI offers a datepicker plugin to which themes can be applied. In this recipe, we'll see how to use or integrate this datepicker in any website.

Getting ready

We'll require the jQuery UI from http://jqueryui.com/, with the datepicker component.

How to do it...

To get the datepicker widget, we create a date input field to get date of birth. We set the name and id attributes to dob.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="themes/base/jquery.ui.all.css" />
<script src="js/jquery.js"></script>
<script src="js/ui/jquery.ui.core.js"></script...