JSFiddle - React, Tailwind, and code Playground

by Danish Farman

HTML

<!DOCTYPE html>
<html>
<body>
<h3>A demonstration of how to access a Date field</h3>
<input type="date" id="myDate" value="">
<p>Click the button to get the date of the date field.</p>

<b>
How to add a datepicker in form using HTML
</b>
<br>
<h4>Date Of Birth:
<input type="text" id="Test_DatetimeLocal">
</h4>
</body>
</html>

JavaScript

window.addEventListener('load', function() {

var d1 = document.getElementById('myDate');
d1.addEventListener('change', function(e) { console.log(e.target.value); });

var d2 = document.getElementById('Test_DatetimeLocal');
d2.addEventListener('change', function(e) { console.log(e.target.value); });

});