mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
38101a478b
Support keyboard control. Fix close on second click. Add removal notice.
42 lines
1.1 KiB
HTML
42 lines
1.1 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>jQuery UI Datepicker - Icon trigger</title>
|
|
<link rel="stylesheet" href="../../themes/base/all.css">
|
|
<link rel="stylesheet" href="../demos.css">
|
|
<script src="../../external/requirejs/require.js"></script>
|
|
<script src="../bootstrap.js">
|
|
var allowOpen = false,
|
|
datepicker = $( "#datepicker" ).datepicker({
|
|
beforeOpen: function() {
|
|
return allowOpen;
|
|
},
|
|
open: function() {
|
|
allowOpen = false;
|
|
}
|
|
} ),
|
|
widget = datepicker.datepicker( "widget" );
|
|
|
|
$( "<a href='#'>")
|
|
.append( "<img src='images/calendar.gif' tabindex='0' alt='Open Datepicker'>" )
|
|
.insertAfter( datepicker )
|
|
.on( "click", function( event ) {
|
|
allowOpen = true;
|
|
if ( widget.is( ":hidden" ) ) {
|
|
datepicker.focus();
|
|
}
|
|
event.preventDefault();
|
|
});
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<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. This demo will be removed soon since its promoting bad practice. Please see our migration guide.</p>
|
|
</div>
|
|
</body>
|
|
</html>
|