-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
34 lines (30 loc) · 866 Bytes
/
script.js
File metadata and controls
34 lines (30 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
console.log('Hola mundo');
const lis = document.querySelectorAll('.rating');
const card = document.querySelector('#card');
const thank = document.querySelector('#thank');
const btn = document.querySelector('.card__buttom');
const span_thank = document.querySelector('.rating--selected');
let value;
lis.forEach((li) => {
li.addEventListener('click', (e) => {
if (li.classList.contains('clicked')) {
li.classList.remove('clicked');
} else {
li.classList.add('clicked');
console.log(li.textContent);
}
});
});
btn.addEventListener('click', () => {
spanValue();
span_thank.textContent = value;
card.classList.toggle('container__card');
thank.classList.remove('container__thank');
});
const spanValue = () => {
lis.forEach((li) => {
if (li.classList.contains('clicked')) {
value = li.textContent;
}
});
};