changeBackgroundColour

mail@pastecode.io avatar
unknown
plain_text
7 months ago
342 B
2
Indexable
Never
function changeBackgroundColor(selector) {
    // Select all elements that match the selector
    var elements = document.querySelectorAll(selector);
    
    // Iterate over the NodeList and change each element's background color to yellow
    elements.forEach(function(element) {
        element.style.backgroundColor = 'yellow';
    });
}
Leave a Comment