-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
32 lines (24 loc) · 927 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
28
29
30
31
32
function addComment() {
// Get the message of the new recommendation
let comment = document.getElementById("new_comment");
// Display a pop-up
if (comment.value != null && comment.value.trim() != "") {
console.log("New comment added");
showPopup(true);
// Create a new 'recommendation' element
var element = document.createElement("div");
element.setAttribute("class","comment");
element.innerHTML = "\<span\>“\</span\>" + comment.value + "\<span\>”\</span\>";
document.getElementById("all_comments").appendChild(element);
comment.value = "";
}
}
function showPopup(bool) {
if (bool) {
document.getElementById('popup').style.visibility = 'visible'
} else {
document.getElementById('popup').style.visibility = 'hidden'
}
}
var paragraph = document.getElementById('hover-paragraph');
// Add event listeners for mouseover and mouseout