(y,m,d)
| 36 | } |
| 37 | |
| 38 | function displayAge(y,m,d){ |
| 39 | |
| 40 | const years = document.getElementById('years'); |
| 41 | const months = document.getElementById('months'); |
| 42 | const days = document.getElementById('days'); |
| 43 | |
| 44 | years.innerText = y; |
| 45 | months.innerText = m; |
| 46 | days.innerText = d; |
| 47 | |
| 48 | if(y >= 0){ |
| 49 | error.style.display = `none`; |
| 50 | } |
| 51 | if(y < 0){ |
| 52 | error.style.display = `block`; |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | container.addEventListener('input', getAge); |