-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
22 lines (21 loc) · 786 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
document.addEventListener('click', action);
function action(e) {
const qty = parseInt(document.getElementById('qty').value);
if(e.target.id === 'male') {
let output = '';
for(let i=0; i<qty; i++) {
output += `
<img class="p-2" src="https://randomuser.me/api/portraits/men/${Math.floor(Math.random()*100)}.jpg">
`;
}
document.getElementById('images').innerHTML = output;
} else if(e.target.id === 'female') {
let output = '';
for(let i=0; i<qty; i++) {
output += `
<img class="p-2" src="https://randomuser.me/api/portraits/women/${Math.floor(Math.random()*100)}.jpg">
`;
}
document.getElementById('images').innerHTML = output;
}
}