open: function() {
allowOpen = false;
}
- });
+ } ),
+ widget = datepicker.datepicker( "widget" );
- $( "<img src='images/calendar.gif' alt='Open Datepicker'>")
+ $( "<a href='#'>")
+ .append( "<img src='images/calendar.gif' tabindex='0' alt='Open Datepicker'>" )
.insertAfter( datepicker )
- .on( "click", function() {
+ .on( "click", function( event ) {
allowOpen = true;
- datepicker.focus();
+ if ( widget.is( ":hidden" ) ) {
+ datepicker.focus();
+ }
+ event.preventDefault();
});
</script>
</head>
<p>Date: <input type="text" id="datepicker"></p>
<div class="demo-description">
-<p>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.</p>
+<p>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.</p>
</div>
</body>
</html>