Bootstrap Datepicker - Months and Years Only

后端 未结 8 1578
逝去的感伤
逝去的感伤 2020-12-02 07:07

I am using bootstrap datepicker and my code is like following, Demo of the code on jsfiddle

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 08:11

    How about this :

    $("#datepicker").datepicker( {
        format: "mm-yyyy",
        viewMode: "months", 
        minViewMode: "months"
    });
    

    Reference : Datepicker for Bootstrap


    For version 1.2.0 and newer, viewMode has changed to startView, so use:

    $("#datepicker").datepicker( {
        format: "mm-yyyy",
        startView: "months", 
        minViewMode: "months"
    });
    

    Also see the documentation.

提交回复
热议问题