+ 2

Is there any other ways to reduce this code especially option tag?

https://code.sololearn.com/WFoDvCc4OPRv/?ref=app

1st Aug 2022, 12:30 PM
KINGFISHER
KINGFISHER - avatar
1 Respuesta
+ 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"/>
1st Aug 2022, 12:38 PM
Мартин 😑🎵
Мартин 😑🎵 - avatar