I'm having some issues setting an attribute to my class name m-date-entry__day-field.
This works: document.getElementById("create-password").setAttribute("value", "ye345s345");, but only supports Id.
I have tried getElementByClassName, without any success.
Element:
<input class="m-date-entry__day-field" type="number" name="day" min="1" max="31" pattern="\b^(0?[1-9]|[1-2][0-9]|3[0-1])$\b" value="" placeholder="DD" required="" data-date="" data-date-day="" data-test="date-entry-day" tabindex="4" autocomplete="bday-day">
So my end goal is just wanting to set the attribute "1".
Any ideas why document.getElementByClassName("m-date-entry__day-field").setAttribute("value", "1");