jQuery UI & Datepicker: Trigger by icon

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

jQuery UI Datepicker – Icon trigger

Click the icon next to the input field to show the datepicker.

Set the datepicker to open on focus (default behavior), on icon click, or both.

<!doctype html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <title>jQuery UI Datepicker - Icon trigger</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'>
    <script>
        $(function () {
            $('#datepicker').datepicker({
                showOn: 'button',
                buttonImage: 'http://jqueryui.com/resources/demos/datepicker/images/calendar.gif',
                buttonImageOnly: true
            });
        });
    </script>
</head>
<body>

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

</body>
</html>
Try The Code Datepicker Widgets API Doc
Series Navigation<< jQuery UI & Datepicker: Display month & year menus
jQuery UI & Datepicker: Display multiple months >>

Leave a comment

Leave a Reply