jQuery UI & Datepicker: Add alternate date box

This entry is part 8 of 14 in the series jQuery UI Datepicker

jQuery UI Datepicker – Populate alternate field

Populate an alternate field with its own date format whenever a date is selected using the altField and altFormat options.

This feature could be used to present a human-friendly date for user selection, while passing a more computer-friendly date through for further processing.

<!doctype html>
<html lang='en'>
    <meta charset='utf-8'>
    <title>jQuery UI Datepicker - Populate alternate field</title>
    <link rel='stylesheet' href='//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css'>
    <script src='//code.jquery.com/jquery-1.10.2.js'></script>
    <script src='//code.jquery.com/ui/1.10.4/jquery-ui.js'></script>
    <link rel='stylesheet' href='http://codecrawl.com/code/jqueryui/jqueryui_style.css'>
        $(function() {
                altField: '#alternate',
                altFormat: 'DD, d MM, yy'

<p>Date: <input type='text' id='datepicker'> <input type='text' id='alternate' size='30'></p>

Try The Code Datepicker Widgets API Doc
Series Navigation<< jQuery UI & Datepicker: Display button bar
jQuery UI & Datepicker: Display inline >>

Leave a comment

Leave a Reply