bootstrap datepicker选项似乎不起作用(由vitalets提供的datepicker)

我包括了所有内容,但它似乎不适用于选项,没有新的例子是痛苦..帮助..

HTML

 

JS

 $('#datepicker').datepicker({ autoclose: true, todayBtn: true, todayHighlight: true }); 

github参考: https : //github.com/vitalets/bootstrap-datepicker#autoclose

你的代码很好,

检查这个JSFiddle ,当我选择一个日期时, datepicker将被关闭。

 autoclose: true //this will work with vitalets 

我想以下是可能的原因:

1)可能错误的bootstrap.datepicker.js

  

确保你的路径是正确的

试试这个:

 $('.datepicker').datepicker() .on('changeDate', function(ev){ $('.datepicker').datepicker('hide'); }); 

更新:

autoclose与以下repo中存在的autoclose正常工作:

https://github.com/eternicode/bootstrap-datepicker

todayBtn:true指示按钮仅将今天带入视图,而不是选择它。 如果您希望按钮实际更改所选日期,请使用:

 todayBtn: "linked" 

请参阅: https : //github.com/uxsolutions/bootstrap-datepicker/issues/314