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

查看:27
本文介绍了清除 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

我在单击按钮时无法清除日期选择器的日期值.我已经检查了 API,但在清除/重置日期选择器时找不到任何内容.欢迎任何帮助

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("").datepicker("update");
})

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

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