JQuery Calendar Does Not Trigger OnChange JS

Hi Experts,

I am building a larger application and I have been using the JQuery Calendar from http://keith-wood.name/calendars.html successfully in many places. However, currently I need to trigger a JS function from the textbox's onchange event, and when I change the date manually (with keyboard) the function triggers successfully, but when I use the calendar it does not.

Since this Jquery calendar requires a lot of files, I zipped my prototype, but you will see my code in index.html is pretty simple. I also prefer to stick with this calendar as I am mentioned, I used it in many places in this application.

Thank you
date.zip
APD TorontoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

Julian HansenCommented:
Try this
<script type="text/javascript">
   $(function() {
        $("#txtBookDate").calendarsPicker({
			onClose: function(dates) { alert('Closed with date(s): ' + dates); },
			firstDay: 1, 
			dateFormat: 'yyyy-mm-dd'
		}); //Customized to start on a Monday and to match MySQL
    });
</script>

Open in new window

Refer to the Events API Doc here http://keith-wood.name/calendarsPicker.html#events

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:
I'm sorry, my jQuery skills aren't good, and I adjusted the code as below, in order to call my changed() function, but I'm not getting my "Hello".  Of course, my changed() function will be more than that, so I need to call it...

...
...
<script type="text/javascript">
   $(function() {
       
       //Call function
        $("#txtBookDate").calendarsPicker({
            onclose: function(dates){changed();},
            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>

Open in new window

David H.H.LeeCommented:
Hi APD_Toronto,
use onClose instead of onclose as advised by Julian.

<script type="text/javascript">
   $(function() {
        $("#txtBookDate").calendarsPicker({
		onClose:  function(dates){changed();},
		firstDay: 1, 
		dateFormat: 'yyyy-mm-dd', 
		}); //Customized to start on a Monday and to match MySQL
    });
	
	function changed(){
		alert('Hello!');
	}
</script>

Open in new window

Julian HansenCommented:
@David H Lee
use onClose instead of onclose as advised by Julian.
I did not have onclose in my post - it was onClose - you basically recommended to the author to do exactly what I posted. The author copied it as onclose.

Please read the posts before posting.
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.