document.addEventListener("DOMContentLoaded", function () { const divElements = document.querySelectorAll('[data-image]'); divElements.forEach((div) => { const imgURL = div.getAttribute('data-image'); if (imgURL) { div.style.backgroundImage = `url(${imgURL})`; } }); });