-
Notifications
You must be signed in to change notification settings - Fork 0
/
rating.js
19 lines (15 loc) · 628 Bytes
/
rating.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
document.getElementById('second').style.display = 'none';
const userOptions = document.querySelectorAll('button');
const userRating = document.getElementById('user-choice');
userOptions.forEach((btn, index) => {
btn.setAttribute('id', index + 1);
btn.addEventListener('click', buttonClicked);
})
function buttonClicked(btn) {
userRating.innerHTML = btn.target.id;
document.querySelector('input').addEventListener('click', submitResult)
function submitResult() {
document.getElementById('first').style.display = 'none';
document.getElementById('second').style.display = 'flex';
}
}