如何使用on.change功能自动清除/重置日期选择器



我已经尝试了以下多种方法,使用on.(change)函数清除/重置日期选择器的值,但没有成功。我正在使用带有Bootstrap 4的Air Datepicker插件。

HTML

<select title="-- NODE --" id="nodes" class="selectpicker form-control" multiple>
<option value="">-- NODE --</option>
</select>
<input id="date" type="text" class="form-control datepicker-here">

JS(3路(

$("#nodes").change(function() {
$("#date").empty();
});
$("#nodes").change(function() {
$("#date").val("").datepicker(clear);
});
$("#nodes").change(function() {
$("#date").data(datepicker).clear()
});

这个怎么样?

$('#nodes').on('change', function() {
$('#date').val('');
});

最新更新