I am implementing a Booking form where I want the date to be set to default to today . It should also be shown as a placeholder in the input. Is there any way it can be possible in HTML5.
<input type="date" name="from" value="" id="date" class="ajaxField required"/>
I think there is no way to do this using pure HTML, but you can use a simple js script:
HTML:
<head>
<script src="script.js" defer></script>
</head>
<body>
<form>
<input id="time">
</form>
</body>
JS:
const time = document.getElementById("time")
let today = new Date();
time.placeholder=today.toString().slice(4, 10)