0

【笔记】BootstrapDatepicker学习笔记

 2 years ago
source link: https://feiju12138.github.io/2022/07/22/BootstrapDatepicker%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【笔记】BootstrapDatepicker学习笔记

2022-07-22

1

利用BootstrapDatepicker添加一个日期选择器

<link rel="stylesheet" href="dist/css/bootstrap.css">
<link rel="stylesheet" href="dist/css/bootstrap-datepicker.css">
<link rel="stylesheet" href="dist/css/bootstrap-datepicker.standalone.css">

<script src="dist/js/jquery.js"></script>

<script src="dist/js/bootstrap.js"></script>
<script src="dist/js/bootstrap.bundle.js"></script>
<script src="dist/js/bootstrap-datepicker.js"></script>
<script src="dist/js/bootstrap-datepicker.zh-CN.min.js"></script>

HTML生成有日期选择器的文本框

data-date-format="yyyy-mm-dd hh:ii":直接指定日期格式化
value="2012-12-12 12:12":指定默认值

<input type="text" class="form-control" id="time">

JS初始化日期选择器

// 初始化
$('#time').datepicker();

初始化时添加默认配置

// 初始化时添加配置
$('#time').datepicker({
// 设置语言
language: 'zh-CN',
// 是否选择后自动关闭
autoclose: true,
// 是否显示清除按钮
clearBtn: true,
// 指定日期格式
format: "yyyy-mm-dd"
});

bootstrap-datetimepicker官网
IT小书童——bootstrap-datepicker中文文档


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK