想实现input框点选择日期后,再次点击清空日期选项html
<input type="text" id="check_time" class="am-form-field" style="border-radius:10px;width:180px;background-color:white" placeholder="点击选择查询日期" data-am-datepicker="" readonly="" οnclick="change()">
function change(){
var is_null=document.getElementById('check_time').value;
if(is_null !=""){
document.getElementById('check_time').value="";
}
}
但是发现点击一次成功后就再也没有日期填写到input框中
于是用jquery的attr属性清空input内容
function change(){
var is_null=document.getElementById('check_time').value;
if(is_null !=""){
$("input").attr("value","");
}
}