+ 2
Is there any other ways to reduce this code especially option tag?
1 ответ
+ 1
you can do something like this with javascript
window.onload = () => {
const dates = new Array(31).fill(0).map((v, id) => {
const option = document.createElement('option');
option.value = id;
option.textContent = id;
return option;
});
document.querySelector(".dates")
.append(...dates);
};
or you can use
<input type=date name="birthdate"/>