Whing Dela Cruz
asked on
Today Date
Hi experts, I'm having a problem with the code below where the myDate value is not telling the correct date of the day. On the other hand, the alert message is showing correct answers. Which part of the code is wrong? any help, please!
<!DOCTYPE html>
<html>
<body>
Today: <input type="date" id="myDate">
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
document.getElementById("myDate").valueAsDate = new Date();
alert(new Date);
}
</script>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER