Wednesday, 6 October 2021

Show Date after Date gap in Date picker HTML

 This post help you to show date in date picker HTML form control from a given date gap. For example show date two date further from current date using HTML and JavaScript. 


<html>

<head>

    <title>test</title>

</head>

<body>   

    <p class="line-item-property__field"> 

        <label for="BookingDate">Select Booking Date</label>

        <input type="date" id="BookingDate" name="properties[Booking Date]">

    </p> 

    <script>

        var dd = new Date();

        dd.setDate(dd.getDate() + 2);

        var today = dd.toISOString().split('T')[0];

        document.getElementById("BookingDate").setAttribute('min', today);

    </script> 

</body>

</html>


No comments:

Post a Comment