Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DoubleBrotherProgrammer/470261 to your computer and use it in GitHub Desktop.
Save DoubleBrotherProgrammer/470261 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>20 min datepicker</title>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
// id of HTML field to associate Datepicker with
var DT_FIELD = "date_field";
// activate datepicker field when the document is ready
$(document).ready(function()
{
// show datepicker
$( "#"+DT_FIELD ).datepicker(
{
// hook up datepicker onSelect handler
onSelect: function(dateText, inst)
{
inst.text = dateText;
}
}
);
}
);
</script>
</head>
<body>
Click text field to get <a href="http://docs.jquery.com/UI/Datepicker">datepicker</a>
<br /><br />
<input type="text" id="date_field" readonly="readonly" />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment