jquery-ui/demos/datepicker/icon-trigger.html

41 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" );
$( "<button>" )
.append( "<img src='images/calendar.gif' alt='Open Datepicker'>" )
.insertAfter( datepicker )
.on( "click", function() {
allowOpen = true;
if ( widget.is( ":hidden" ) ) {
datepicker.focus();
}
});
</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>