-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
27 lines (25 loc) · 878 Bytes
/
script.js
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
function addReview(event) {
event.preventDefault();
let name = document.getElementById("name_text").value;
let text = document.getElementById('text_area').value;
if (!text) {
alert('Fulfill the review first...');
document.getElementById('text_area').focus();
return;
}
else {
let newReview = document.createElement('div');
newReview.className = "recommendation-container";
newReview.innerHTML = `\<p\>\<em\>${name ? name + ": \&\#34\;" : "\&\#34\;"}${text + "\&\#34\;"}\</em\>\</p\>`;
document.getElementById('recommendations').appendChild(newReview);
//window.confirm("Thank you for submitting a recommendation!");
showPopup(true);
}
}
function showPopup(bool) {
if (bool) {
document.getElementById('popup').style.visibility = 'visible'
} else {
document.getElementById('popup').style.visibility = 'hidden'
}
}