bootstrap datepicker的基本使用教程
更新時間:2019年07月09日 10:26:01 作者:xc丶卡卡
這篇文章主要介紹了bootstrap datepicker的基本使用教程,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
首先
引入相應css和js:
<link rel="stylesheet" th:href="@{/assets/css/datepicker.css}" rel="external nofollow" /> <script th:src="@{/assets/js/date-time/bootstrap-datepicker.js}"></script>
然后html代碼裝載控件
<div class="input-group"> <input class="form-control date-picker" id="endTime" data-date-end-date="0m" type="text" placeholder="選擇年月"/> <span class="input-group-addon"> <i class="fa fa-calendar bigger-110"></i> </span> </div>
初始化控件:
$('#endTime').datepicker({ format: 'yyyy-mm', startView: 1, maxViewMode: 1,minViewMode:1, autoclose :true })
現(xiàn)在可以看效果了:
選擇日期后觸發(fā)事件:
$('#endTime').datepicker({ format: 'yyyy-mm', startView: 1, maxViewMode: 1,minViewMode:1, autoclose :true }).on("changeMonth", function(e) { var date_=e.date; var year_str = date_.getFullYear(); var month_str = date_.getMonth()+1; if(month_str<10){ month_str="0"+month_str; } var endMonth=year_str+"-"+month_str; getLitDirection(endMonth); getLitSaleTop(endMonth); getLitViewTop(endMonth); getLitErrorRecovery(endMonth); var month_value=year_str+"年"+(date_.getMonth()+1)+"月"; $("#end_Time").html(month_value); $("#split1").show(); $("#split2").show(); }).next().on(ace.click_event, function(){ $(this).prev().focus(); });
總結
以上所述是小編給大家介紹的bootstrap datepicker的基本使用教程 ,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉載,煩請注明出處,謝謝!
您可能感興趣的文章:
- JS控件bootstrap datepicker使用方法詳解
- BootStrap Datepicker 插件修改為默認中文的實現(xiàn)方法
- 淺談Bootstrap的DatePicker日期范圍選擇
- bootstrap datepicker限定可選時間范圍實現(xiàn)方法
- bootstrap datepicker 與bootstrapValidator同時使用時選擇日期后無法正常觸發(fā)校驗的解決思路
- BootStrap中Datepicker控件帶中文的js文件
- BootStrap的Datepicker控件使用心得分享
- bootstrap 日期控件 datepicker被彈出框dialog覆蓋的解決辦法
相關文章
理解JavaScript中的Proxy 與 Reflection API
這篇文章主要介紹了JavaScript中的Proxy 與 Reflection API的相關資料,幫助大家更好的理解和學習JavaScript,感興趣的朋友可以了解下2020-09-09javascript實現(xiàn)可全選、反選及刪除表格的方法
這篇文章主要介紹了javascript實現(xiàn)可全選、反選及刪除表格的方法,實例展示了javascript針對表格全選、反選、刪除、隔行變色、刪除提示等常用技巧,非常具有實用價值,需要的朋友可以參考下2015-05-05利用JavaScript編寫Python內置函數(shù)查詢工具
Python有豐富的內置函數(shù)實現(xiàn)各種功能,但查詢內置函數(shù)時總是需要百度查,有沒有一個小工具可以單機無網(wǎng)絡查詢Python內置函數(shù),方便自己學習編寫Python程序呢?本文就來用JavaScript編寫一個2023-02-02