I am trying to see what value my date input field has however I am always left with null in my console.
I am using the following JS to console.log
my date input value:
document.getElementById('date_of_birth').addEventListener('change', function() {
console.log(this.getAttribute('value'));
});
Here is my input field also:
<input id="date_of_birth"
class="input input--bravo pad-1/2 span-1x field-date_of_birth is-invalid"
data-palm="span-1x"
placeholder="dd/mm/yyyy"
pattern="\d{2}\/\d{2}\/\d{4}*"
name="payload[date_of_birth]"
type="date" _flx1_12_1="1" _flx1_13_1="1">
When I select a date my JS triggers however prints null into the console. Why doesn't it show the date I have selected? I only want to see the date so I can see how the value is formatted so I can setup some validation for it.
Thanks, Nick