JQuery Calendar Today

Hi Experts,

I'm not great at JQuery, but I'm using the calendar from http://keith-wood.name/datepick.html.  If you click on the "Today" button on the calendar in the top-center, you'll see it doesn't select the current date, just shows the current month.  This is more evident if yo are viewing a different month/year.

My question is, how can I customize this control, so when "today" is clicked, it does select the today's date, and closes the datepicker control (the same effect that it has when you click on an actual date).

Thank you
APD TorontoSoftware DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

APD TorontoSoftware DeveloperAuthor Commented:
I decided to create the attached prototype with all source files from the above website.  Of course my file is index.html, and when you click in the textbox, the calendar will popup as expected. As mentioned above, I need when clicked "today", today's date to appear in the textbox and the popup to close.

The reason why I am attaching this as zip, is because there are a few source files.

Any help will be greatly appreciated.
date.zip
0
hieloCommented:
Try:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="jquery.calendars.picker.css">
    </head>
    <body>
        <input type="text" id="txtBookDate" onchange="changed();">

<!--Common JS Libraries, also needed for Date Picker -->
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.plugin.js"></script>

<!--JS=Specific to Date Picker Control-->
<script type="text/javascript" src="jquery.calendars.min.js"></script>
<script type="text/javascript" src="jquery.calendars.plus.min.js"></script>
<script type="text/javascript" src="jquery.calendars.picker.min.js"></script>
<script type="text/javascript">
   $(function() {
        //retrieve default commands
        var todayCommand = $.extend(true, {}, $.calendarsPicker.commands);

        //override only "today.action"
        todayCommand.today.action = function(inst){
                //show popup
                $.calendarsPicker.showMonth(this);

                //update value of text field
                $(this).val( $.calendars.newDate() );

                // uncomment the following line if you want the popup to auto-hide
                //$.calendarsPicker.hide(this);
            };

         //use the altered commands saved in "todayCommand" to override the default settings
        $("#txtBookDate").calendarsPicker({commands:todayCommand, firstDay: 1, dateFormat: 'yyyy-mm-dd'}); //Customized to start on a Monday and to match MySQL
    });
</script>
<script type="text/javascript">
    function changed(){
        alert('Hello');
    }
</script>


    </body>
</html>

Open in new window

1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
APD TorontoSoftware DeveloperAuthor Commented:
Thank you very much!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.