Live Demo
Click the field below to open a real calendar and pick a date. The selected date is echoed underneath via onSelect.
No date selected yet.
jQuery UI's datepicker() widget turns a plain text input into a full calendar picker. Users can click the field to pop open a month view, navigate months/years, and pick a date without typing it by hand. It's built entirely on top of jQuery, so it works with the same selectors and events you already know.
| Option / Event | Description | Example |
|---|---|---|
.datepicker() | Attaches a popup calendar to a text input. | $('#date').datepicker(); |
dateFormat | Controls the format of the value written into the input. | dateFormat: 'yy-mm-dd' |
minDate / maxDate | Restrict the selectable date range. | minDate: 0, maxDate: '+1M' |
inline: true | Renders the calendar directly on the page instead of a popup. | $('#cal').datepicker({ inline: true }); |
onSelect | Callback fired when a date is chosen. | onSelect: function(date){ ... } |
jquery-ui.css) so the calendar renders with proper styling and highlighted "today"/selected dates.dateFormat Option
$('#date').datepicker({
dateFormat: 'yy-mm-dd' // e.g. 2026-08-14; try 'dd/mm/yy' too
});
minDate / maxDate
$('#date').datepicker({
minDate: 0, // no past dates
maxDate: '+1M' // up to one month ahead
});
onSelect Callback
$('#date').datepicker({
onSelect: function(dateText){
console.log(dateText); // the chosen date string
}
});
Click the field below to open a real calendar and pick a date. The selected date is echoed underneath via onSelect.
readonly.