kleine update, pagina voor questions beginning template

This commit is contained in:
Bram Barbieri
2024-03-31 14:11:33 +02:00
parent eea0828b37
commit 074406aec5
3 changed files with 43 additions and 4 deletions

View File

@@ -0,0 +1,28 @@
// Sample data
const dataItems = [
{ id: 1, name: "Item 1", description: "Description for Item 1" },
{ id: 2, name: "Item 2", description: "Description for Item 2" },
{ id: 3, name: "Item 3", description: "Description for Item 3" }
];
// Function to display data items on the webpage
function displayDataItems() {
const container = document.getElementById("data-container");
// Clear previous content
container.innerHTML = "";
// Loop through data items and create HTML elements
dataItems.forEach(item => {
const itemElement = document.createElement("div");
itemElement.classList.add("data-item");
itemElement.innerHTML = `
<h2>${item.name}</h2>
<p>${item.description}</p>
`;
container.appendChild(itemElement);
});
}
// Call the function to display data items when the page loads
window.onload = displayDataItems;