generated from skills/github-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blogCase.js
19 lines (17 loc) · 733 Bytes
/
blogCase.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
document.addEventListener("DOMContentLoaded", function () {
// Fetch JSON data
fetch('blogs/comingSoon/comingsoon.json')
.then(response => response.json())
.then(jsonData => {
const blogImages = document.querySelectorAll(".blogImage");
const blogDescriptions = document.querySelectorAll(".blogDescription");
// Update HTML content with fetched JSON data
blogImages.forEach(imageElement => {
imageElement.setAttribute("src", jsonData.item.imageURL);
});
blogDescriptions.forEach(descriptionElement => {
descriptionElement.textContent = jsonData.item.description;
});
})
.catch(error => console.error('Error fetching JSON:', error));
});