📅  最后修改于: 2023-12-03 14:43:11.972000             🧑  作者: Mango
jQuery UI Datepicker is a popular plugin that is useful for adding a customizable datepicker to your web application. The weekHeader option is one of the many features included in this plugin that allows you to specify the text that appears above the columns on the calendar to represent the days of the week.
To enable the weekHeader option, you need to specify the following parameters:
$( ".datepicker" ).datepicker({
weekHeader: "Wk"
});
This will change the header to a two-letter abbreviation of "Week". You can customize the WeekHeader by changing the text to whatever you like. The weekHeader can also optionally be set to false, which will remove the header entirely.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery UI Datepicker weekHeader Option</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.12.4.js"></script>
<script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$(function() {
$( "#datepicker" ).datepicker({
weekHeader: "Wk" // Customize the WeekHeader
});
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
</body>
</html>
In this example, the weekHeader has been customized to "Wk".