在模态引导程序4上选中单选按钮时,我有问题要清空日期范围
这是HTML代码:
<div class="form-group row">
<label class="col-md-3 col-form-label">Island A Kanan</label>
<div class="col-md-9">
<div class="radio">
<input type="radio" name="r1cian" value="0" id="r1cian" checked="checked">Normal
<input type="radio" name="r1cian" value="1" id="r2cian" > Abnormal
</div>
<span class="help-block"></span>
</div>
</div>
<div class="form-group row " id="tglan">
<label class="col-lg-3 col-form-label">Date Range</label>
<div class="col-lg-9">
<div class="input-daterange input-group">
<input type="text" class="form-control-sm form-control" name="tglscian" id="tgl" placeholder="Start Date" readonly>
<div class="input-group-addon">to</div>
<input type="text" class="form-control-sm form-control" name="tglecian" id="tgl" placeholder="End Date" readonly>
</div>
<span class="help-block"></span>
</div>
</div>
这是代码Ajax / JS:
success: function(data)
{
if (data.stsAkn == "0") {
$('#r1cian').prop('checked', true)
$('#tgl').datepicker('update', '');
$("#tglan").hide();
} else if (data.stsAkn == "1") {
$('#r2cian').prop('checked', true)
$("#tglan").show();
$('[name="tglscian"]').val(data.stglAkn);
$('[name="tglecian"]').val(data.etglAkn);
}
}
我尝试过
$('#tgl').datepicker('update', '');
$('[name="tglscian"]').datepicker('update', '');
$('[name="tglecian"]').datepicker('update', '');
$('#tgl').val('');
但是仍然不能清空日期, 有什么解决方案?
我使用引导日期选择器 https://github.com/uxsolutions/bootstrap-datepicker