I made a date input in my HTML file to select birthday, but how do I get the selected date value using vanilla JavaScript? I only managed to get the attribute itself and not the selected date.
My HTML file:
<div class=wrapper>
<h1 class="age-text">Your Age is:</h1>
<h1 class="age">0 years, 0 months, 0 days</h1>
<label class="enter-age-text" for="">Enter Your birthday below:</label>
<input class="birthday" type="date" name="" id="">
<button>Calculate</button>
</div>
My JS file:
let birthday = document.querySelector('.birthday');
let button = document.querySelector('button');
button.addEventListener("click", e => {
console.log(birthday);
})

birthday.max = new Date().toISOString().slice(0, 10)