|
1 |
| - |
2 |
| -window.onload = function() |
| 1 | +const load = function() |
3 | 2 | {
|
4 | 3 | const initPerson = personGenerator.getPerson();
|
5 |
| - document.querySelector('#firstNameOutput').innerText = initPerson.firstName; |
6 |
| - document.querySelector('#surnameOutput').innerText = initPerson.surName; |
7 |
| - document.querySelector('#fatherNameOutput').innerText = initPerson.fathername; |
8 |
| - document.querySelector('#genderOutput').innerText = initPerson.gender; |
9 |
| - document.querySelector('#birthYearOutput').innerText = initPerson.birthday; |
10 |
| - document.querySelector('#jobOutput').innerText = initPerson.job; |
| 4 | + |
| 5 | + console.log(initPerson); |
| 6 | + |
| 7 | + document.querySelector('#firstNameOutput').textContent = initPerson.firstName; |
| 8 | + document.querySelector('#surnameOutput').textContent = initPerson.surName; |
| 9 | + document.querySelector('#fatherNameOutput').textContent = initPerson.fathername; |
| 10 | + document.querySelector('#genderOutput').textContent = initPerson.gender; |
| 11 | + document.querySelector('#birthYearOutput').textContent = initPerson.birthday; |
| 12 | + document.querySelector('#jobOutput').textContent = initPerson.job; |
| 13 | +}; |
| 14 | + |
| 15 | +const clear = function() |
| 16 | +{ |
| 17 | + document.querySelector('#firstNameOutput').textContent = "-"; |
| 18 | + document.querySelector('#surnameOutput').textContent = "-"; |
| 19 | + document.querySelector('#fatherNameOutput').textContent = "-"; |
| 20 | + document.querySelector('#genderOutput').textContent = "-"; |
| 21 | + document.querySelector('#birthYearOutput').textContent = "-"; |
| 22 | + document.querySelector('#jobOutput').textContent = "-"; |
| 23 | + |
| 24 | + |
11 | 25 | };
|
12 | 26 |
|
| 27 | +addEventListener("load", load); |
| 28 | + |
| 29 | +document.querySelector("#reloadBtn").addEventListener("click", load); |
| 30 | + |
| 31 | +document.querySelector("#clearBtn").addEventListener("click", clear); |
0 commit comments