Open Sailwayfun opened 1 month ago
請先確認資源路徑是否正確,像我就看到你多了一個左斜線在bootstrap-datepicker.zh-TW.min.js的js,另外bootstrap-datepicker的用法以及css請參考官網的,你只需要把核心js替代成我的,我用以下html可正常運作,但css你要引入,我這沒有加css,如下html
<html>
<head>
<title>tw date picker</title>
<script src="jquery-3.5.0.min.js"></script>
<script src="bootstrap-datepicker-v1.9.0/js/bootstrap-datepicker.js"></script>
<script src="bootstrap-datepicker-v1.9.0/locales/bootstrap-datepicker.zh-TW.min.js"></script>
</head>
<body>
選擇日期
<input id="date-picker" type="text" value="">
<a href="javascript:void(0);" class="toggleStartUpDate">請點我</a>
<script>
var myDatePicker = $("#date-picker").datepicker({
format: "twy-mm-dd",
language: "zh-TW",
showOnFocus: false,
todayHighlight: true
}).on("show", (e) => {
$("div.box").css({
minHeight: "480px"
});
}).on("hide", (e) => {
$("div.box").css({
minHeight: "auto"
});
});
$("a.toggleStartUpDate").on("click", function () {
myDatePicker.datepicker( "customizeEvent" );
});
</script>
</body>
</html>
您好,我下載後,即使在語言選項使用 "zh-TW",date-picker 顯示的年份仍為西元
HTML:
` <!DOCTYPE html>
`
index.js
$("#date-picker").datepicker({ format: "twy-mm-dd", language: "zh-TW", showOnFocus: false, todayHighlight: true }).on("show", (e) => { $("div.box").css({ minHeight: "480px" }); }).on("hide", (e) => { $("div.box").css({ minHeight: "auto" }); });