]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker div now appends to the document after the datepicker(); function is called...
authorMarc Grabanski <m@marcgrabanski.com>
Sun, 20 Jul 2008 17:09:09 +0000 (17:09 +0000)
committerMarc Grabanski <m@marcgrabanski.com>
Sun, 20 Jul 2008 17:09:09 +0000 (17:09 +0000)
ui/ui.datepicker.js

index 8ec7d7de9edaff5a33388902e2054b1906451f2f..a044575245d605600b7cc154b15247173f9201f3 100644 (file)
@@ -1560,6 +1560,17 @@ function isArray(a) {
                     Object - settings for attaching new datepicker functionality
    @return  jQuery object */
 $.fn.datepicker = function(options){
+       
+       /* Initialise the date picker. */
+       if (!$.datepicker.initialized) {
+               $(function() {
+                       $(document.body)
+                               .append($.datepicker.dpDiv)
+                               .mousedown($.datepicker._checkExternalClick);
+               });
+               $.datepicker.initialized = true;
+       }
+       
        var otherArgs = Array.prototype.slice.call(arguments, 1);
        if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate'))
                return $.datepicker['_' + options + 'Datepicker'].
@@ -1573,11 +1584,6 @@ $.fn.datepicker = function(options){
 };
 
 $.datepicker = new Datepicker(); // singleton instance
-       
-/* Initialise the date picker. */
-$(document).ready(function() {
-       $(document.body).append($.datepicker.dpDiv).
-               mousedown($.datepicker._checkExternalClick);
-});
+$.datepicker.initialized = false;
 
 })(jQuery);