清除bootstrap-datepicker的值 [英] Clear the value of bootstrap-datepicker

查看:156
本文介绍了清除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("");
})

这篇关于清除bootstrap-datepicker的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆