Moving Focus Out of Control

Hi Experts,

With the help of Expert heilo, I have the following JQuery
<!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


the above  JQuery is a modification to a calendar that when the user clicks "today" it places the current date in the provided textbox and closes the calendar. This works well, but if I try to go immediately to another date, I cant because the calendar does not reopen. However,  if I click anywhere else outside of the textbox, then click the textbox, this re-opens the calendar.

I am concluding therefore that after line 39, I need to move focus out of the control, either by sending a tab key (I think key #13), or something else?

Any help will be appreciated.
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.

hieloCommented:
>> Expert heilo
Huh???

Immediately after 39 try:
$(this).blur();
0

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:
Sorry hielo, but I really appreciate your help.
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.