-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
31 lines (25 loc) · 882 Bytes
/
script.js
File metadata and controls
31 lines (25 loc) · 882 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
const modal = document.querySelector(".thankYu");
const openModalBtn = document.querySelector(".btn");
const closeModalBtn = document.querySelector(".btnClose");
const cardElement = document.querySelector(".card");
const form = document.querySelector('form');
const ratingElement = document.getElementById('rating');
openModalBtn.addEventListener("click", () => {
cardElement.style.display = "none";
modal.showModal();
});
closeModalBtn.addEventListener("click", () => {
modal.close();
cardElement.style.display = "block";
});
form.addEventListener('submit', function(event) {
event.preventDefault();
var selected = document.querySelector('input[name="rating"]:checked');
if (selected) {
var value = selected.value;
ratingElement.textContent = value;
} else {
ratingElement.textContent = 'Nenhuma opção selecionada';
}
modal.showModal();
});