Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Commit 2bdb57b

Browse files
Update code.js
1 parent 0b37669 commit 2bdb57b

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

code.js

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,21 @@
1313

1414
// Function to clear existing content
1515
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);
1722
if (contentDiv) {
23+
styles.innerText = `
24+
.questions {
25+
color: red;
26+
background: black;
27+
z-index: 99;
28+
position: absolute;
29+
}
30+
`
1831
console.log("Content container found.");
1932
} else {
2033
console.error("Content container not found.");
@@ -33,23 +46,26 @@
3346

3447
// Function to display questions and answers
3548
function displayQuestionsAndAnswers(questions, responses) {
36-
const contentDiv = document.querySelector(".student-container");
49+
const contentDiv = document.querySelector(".activity-container");
3750
if (contentDiv) {
51+
const wrapper = document.createElement("div");
52+
wrapper.className = "questions";
53+
contentDiv.appendChild(wrapper);
3854
questions.forEach((question, index) => {
3955
const questionDiv = document.createElement("div");
4056
questionDiv.className = "answer";
4157
questionDiv.textContent = `Question: ${question.key}`;
42-
contentDiv.appendChild(questionDiv);
58+
wrapper.appendChild(questionDiv);
4359

4460
const responseDiv = document.createElement("div");
4561
responseDiv.className = "answer";
4662
responseDiv.textContent = `Response: ${responses[index]}`;
47-
contentDiv.appendChild(responseDiv);
63+
wrapper.appendChild(responseDiv);
4864

4965
const separator = document.createElement("br");
5066
separator.className = "answer";
51-
contentDiv.appendChild(separator);
52-
contentDiv.appendChild(separator);
67+
wrapper.appendChild(separator);
68+
wrapper.appendChild(separator);
5369
});
5470
} else {
5571
console.error("Content container not found.");

0 commit comments

Comments
 (0)