Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
jquery ui datepicker IE focus fix
After jquery ui datepicker selection, blur and change
events fire before focus is returned to the input field,
handling a quirk from IE browsers
changeMonth: true,
changeYear: true,
showAnim: "fadeIn",
yearRange: 'c-30:c+30',
showButtonPanel: true,
/* fix buggy IE focus functionality */
fixFocusIE: false,
/* blur needed to correctly handle placeholder text */
onSelect: function(dateText, inst) {
this.fixFocusIE = true;
onClose: function(dateText, inst) {
this.fixFocusIE = true;
beforeShow: function(input, inst) {
var result = $.browser.msie ? !this.fixFocusIE : true;
this.fixFocusIE = false;
return result;
Copy link

There seems to be still one problem on IE with this: if you navigate with Tab through fields, then each second focus on datepicker field will not work. Tested on IE12.

Copy link

@progmars interesting, thanks for the info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment