Layui frame, click a button to clear the value selected by the date plug-in of layui

use layui"s layDate control,
is used in a pop-up window,
pop-up window and the current page are the same page,
click to close the pop-up window to let the previously selected value of layDate empty out
is equivalent to refreshing this control once
what should the gods do?

range used to constrain selection time
var start = laydate.render ({

)
        elem: "-sharptest-out-start",
        format: "yyyy-MM-dd",
        isInitValue: false,
        done: function(value, date, endDate) {
            if(value !==""){
                end.config.min = {
                    year: date.year,
                    month: date.month - 1,
                    date: date.date
                }
            }else {
                end.config.min = {
                    year: 1900,
                    month: 0, //
                    date: 1
                }
            }
        }
    });
    var end = laydate.render({
        elem: "-sharptest-out-end",
        format: "yyyy-MM-dd",
        isInitValue: false,
        done: function(value, date, endDate) {
            if(value != ""){
                start.config.max = {
                    year: date.year,
                    month: date.month - 1,
                    date: date.date
                }
            }else {
                start.config.max = {
                    year: 1900,
                    month: 0, //
                    date: 1
                }
            }
        }
    });
})

May.16,2022

just set the value of date to empty:

document.getElementById('ID').value = ''

The layui style and other links needed in

can be replaced by yourself. Just change the input to a range

.
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="./css/layui.css">
</head>
<body>

<button onclick="openLy()">open</button>
<script src="layui.js"></script>
<script src="layui.all.js"></script>
<script>
    function openLy() {
        layui.use(['layer','form', 'layedit', 'laydate'], function(){
            var form = layui.form
            var layer = layui.layer
            var laydate = layui.laydate;
            var $ = layui.$
            layer.open({
                type: 1,
                content: '<input type="text" id="test1" value="1998">', //contentString
                success: function(layero, index){ //layer
                    //do something
                    laydate.render({
                        elem: '-sharptest1' //
                    });
                },
                cancel: function(index, layero){  //layer
                    $("-sharptest1").val("")
                    layer.close(index)
                }
            });

        });
    }

</script>

have you solved the same problem at present

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b32fbd-2be3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b32fbd-2be3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?