Struggling to implement a skeleton loading screen with CSS classes and JavaScript. The idea is to apply the 'skeleton' class to elements, style them accordingly, then remove the class using a timeout set in JavaScript. However, I'm encountering issues trying to get the JavaScript functionality to work.
Below is the snippet of my JavaScript code responsible for removing the class. Can you spot what might be causing it not to work?
const timeout = setTimeout(loading, 3000);
function loading() {
const element = document.getElementById("skeleton");
element.classList.remove("skeleton");
}