From: Felix Nagel Date: Tue, 25 Aug 2015 16:28:18 +0000 (+0200) Subject: Datepicker: Fix icon trigger demo X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=38101a478b3ee9b91d02fd5c338edf0df9221a4a;p=jquery-ui.git Datepicker: Fix icon trigger demo Support keyboard control. Fix close on second click. Add removal notice. --- diff --git a/demos/datepicker/icon-trigger.html b/demos/datepicker/icon-trigger.html index 2ab3c2e23..ed79840ab 100644 --- a/demos/datepicker/icon-trigger.html +++ b/demos/datepicker/icon-trigger.html @@ -15,13 +15,18 @@ open: function() { allowOpen = false; } - }); + } ), + widget = datepicker.datepicker( "widget" ); - $( "Open Datepicker") + $( "") + .append( "Open Datepicker" ) .insertAfter( datepicker ) - .on( "click", function() { + .on( "click", function( event ) { allowOpen = true; - datepicker.focus(); + if ( widget.is( ":hidden" ) ) { + datepicker.focus(); + } + event.preventDefault(); }); @@ -30,7 +35,7 @@

Date:

-

Click the icon next to the input field to show the datepicker. Set the datepicker to open on focus (default behavior), on icon click, or both.

+

Click the icon next to the input field to show the datepicker. This demo will be removed soon since its promoting bad practice. Please see our migration guide.