Created
June 5, 2012 18:32
-
-
Save jeffsheets/2876765 to your computer and use it in GitHub Desktop.
jquery ui datepicker IE focus fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
After jquery ui datepicker selection, blur and change | |
events fire before focus is returned to the input field, | |
handling a quirk from IE browsers | |
*/ | |
$("input.dateInput").datepicker({ | |
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; | |
$(this).blur().change().focus(); | |
}, | |
onClose: function(dateText, inst) { | |
this.fixFocusIE = true; | |
this.focus(); | |
}, | |
beforeShow: function(input, inst) { | |
var result = $.browser.msie ? !this.fixFocusIE : true; | |
this.fixFocusIE = false; | |
return result; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@progmars interesting, thanks for the info