|
13 | 13 |
|
14 | 14 | // Function to clear existing content |
15 | 15 | function clearContent() { |
16 | | - const contentDiv = document.querySelector(".student-container"); |
| 16 | + const contentDiv = document.querySelector(".activity-container"); |
| 17 | + const styles = document.createElement("style"); |
| 18 | + styles.innerText = ` |
| 19 | + . |
| 20 | + ` |
| 21 | + document.body.appendChild(styles); |
17 | 22 | if (contentDiv) { |
| 23 | + styles.innerText = ` |
| 24 | + .questions { |
| 25 | + color: red; |
| 26 | + background: black; |
| 27 | + z-index: 99; |
| 28 | + position: absolute; |
| 29 | + } |
| 30 | + ` |
18 | 31 | console.log("Content container found."); |
19 | 32 | } else { |
20 | 33 | console.error("Content container not found."); |
|
33 | 46 |
|
34 | 47 | // Function to display questions and answers |
35 | 48 | function displayQuestionsAndAnswers(questions, responses) { |
36 | | - const contentDiv = document.querySelector(".student-container"); |
| 49 | + const contentDiv = document.querySelector(".activity-container"); |
37 | 50 | if (contentDiv) { |
| 51 | + const wrapper = document.createElement("div"); |
| 52 | + wrapper.className = "questions"; |
| 53 | + contentDiv.appendChild(wrapper); |
38 | 54 | questions.forEach((question, index) => { |
39 | 55 | const questionDiv = document.createElement("div"); |
40 | 56 | questionDiv.className = "answer"; |
41 | 57 | questionDiv.textContent = `Question: ${question.key}`; |
42 | | - contentDiv.appendChild(questionDiv); |
| 58 | + wrapper.appendChild(questionDiv); |
43 | 59 |
|
44 | 60 | const responseDiv = document.createElement("div"); |
45 | 61 | responseDiv.className = "answer"; |
46 | 62 | responseDiv.textContent = `Response: ${responses[index]}`; |
47 | | - contentDiv.appendChild(responseDiv); |
| 63 | + wrapper.appendChild(responseDiv); |
48 | 64 |
|
49 | 65 | const separator = document.createElement("br"); |
50 | 66 | separator.className = "answer"; |
51 | | - contentDiv.appendChild(separator); |
52 | | - contentDiv.appendChild(separator); |
| 67 | + wrapper.appendChild(separator); |
| 68 | + wrapper.appendChild(separator); |
53 | 69 | }); |
54 | 70 | } else { |
55 | 71 | console.error("Content container not found."); |
|
0 commit comments