]> source.dussan.org Git - jquery-ui.git/commitdiff
Datepicker: Fix icon trigger demo
authorFelix Nagel <info@felixnagel.com>
Sat, 26 Apr 2014 12:05:56 +0000 (14:05 +0200)
committerScott González <scott.gonzalez@gmail.com>
Thu, 29 Jan 2015 22:48:25 +0000 (17:48 -0500)
demos/datepicker/icon-trigger.html

index e880df27e7fd1ac915ddef5398e605d72a2cbe04..03fb91f812fa320e5d9158cb42cc1a4cb00dc190 100644 (file)
        <link rel="stylesheet" href="../demos.css">
        <script>
        $(function() {
-               var allowOpen = false;
-               var datepicker = $( "#datepicker" ).datepicker({
-                       beforeOpen: function() {
-                               return allowOpen;
-                       }
-               });
-               $( "<img src='images/calendar.gif' alt='Open Datepicker'>")
-                       .insertAfter( datepicker )
-                       .click(function() {
-                               allowOpen = true;
-                               datepicker.focus();
-                               setTimeout(function() {
-                                       allowOpen = false;
-                               });
-                       });
+        var allowOpen = false,
+            datepicker = $( "#datepicker" ).datepicker({
+                beforeOpen: function() {
+                    return allowOpen;
+                },
+                open: function() {
+                    allowOpen = false;
+                }
+            });
+
+        $( "<img src='images/calendar.gif' alt='Open Datepicker'>")
+            .insertAfter( datepicker )
+            .click( function() {
+                allowOpen = true;
+                datepicker.focus();
+            });
        });
        </script>
 </head>