- 关联的js,css
<script type="text/javascript" src="js/jquery.js"></script>
<link href="css/plugins/date/pikaday.css" type="text/css" rel="stylesheet" >
<script type="text/javascript" src="js/plugins/date/moment.js"></script>
<script type="text/javascript" src="js/plugins/date/pikaday.jquery.js"></script>
- 初始化
$(document).ready(function() {
var picker = new Pikaday({
field: document.getElementById('birthDay'),
firstDay: 2,
minDate: new Date('1900-01-01'),
maxDate: new Date(),
yearRange: [1900,2020]
});
});
- 页面
<input type="text" name="birthDay" id="birthDay"/>
- 在pikaday.jquery.js文件中,可以修改基本参数
defaults = {
format: 'YYYY-MM-DD' //可以修改
}