Hi,
Here is the code snippet you can make use of
<input type="date" id="birthDate" name="birthDate" value="Birth Date" />
<script type="text/javascript">
var dt = document.getElementById('birthDate');
if (dt) dt.onchange = function () {
dt.setAttribute('type', 'text');
dt.setAttribute('type', 'date');
}
</script>
Its Just a trick,so do not fully rely on it because it might not escape from Code review I think
But I would always prefer to use Jquery for it.
$(document).ready(function (){
$('#birthDate').datepicker({clickInput:true});
});
You can find some reference from here -
Jquery DatePicker [
^]
My solution in JSFiddle[
^]
Updated solution:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript">
$(window).load(function(){
var dt= document.getElementById('birthDate');
if (dt) {
dt.onchange = function () {
dt.setAttribute('type', 'text');
dt.setAttribute('type', 'date');
}
}
});
</script>
</head>
<body>
<input type="date" name="birthDate" value="Select date" id= "birthDate"/>
</body>
</html>
Hope this helps you a bit.
Regards,
RK