清除bootstrap-datepicker的值
问题描述:
我正在使用bootstrap-datepicker: https://github.com/eternicode/bootstrap-datepicker
I am using bootstrap-datepicker from here: https://github.com/eternicode/bootstrap-datepicker
版本:2.3.2
我无法清除日期值点击按钮时的datepicker。我已经检查了API,但是在清除/重置datepicker时找不到任何东西。欢迎任何帮助
I am having trouble to clear the date values of the datepicker when a button is clicked. I have checked the API but cannot find anything on clearing/resetting the datepicker. Any help is welcome
答
您可以使用jQuery清除日期输入的值。
You can use jQuery to clear the value of your date input.
例如,一个按钮和一个文本输入如下:
For exemple with a button and a text input like this :
<input type="text" id="datepicker">
<button id="reset-date">Reset</button>
您可以使用jQuery的.val()函数。
You can use the .val() function of jQuery.
$("#reset-date").click(function(){
$('#datepicker').val("");
})