Using .change () and datepicker in jquery to submit form

I am currently using the jQuery UI datepicker range, and I have added some more javascript that should send the form on the page when various form elements change.

This works on the dropdown I added, as well as the date input fields, if I enter the dates manually, then click away.

However, if I click on the input field for datepicker and select a date, the form will not be submitted after selecting the date.

As if the input field did not know that a change has occurred.?

http://api.jquery.com/change/

here is the code i use:

$(document).ready(function() { $('#from').change(function() { document.myform.submit(); }); }); $(document).ready(function() { $('#to').change(function() { document.myform.submit(); }); }); 

Using datepicker UI events, I added the following code for testing, but it doesn't work .. any ideas?

 $(document).ready(function() { $('#from').datepicker({ onClose: function() { alert('Yo yo!') } }); }); 
+4
source share
4 answers

The correct answer is here: jQuery datepicker, onSelect will not work

+1
source

JQuery UI DatePicker has custom events, in particular the onSelect event, click the events tab and at the bottom of the document:

http://jqueryui.com/demos/datepicker/

+1
source

Double JavaScript error checking is not higher than the code you provided.

If there are errors, the JavaScript code below these errors will not execute properly.

This is probably why the code added to the test did not work either.

+1
source

Hope this should be on focus . when you click the date select button, the focus will be in the text box where you must specify the date. therefore the event should be .focus()

http://api.jquery.com/focus/

http://api.jquery.com/focusout/

0
source

All Articles