changeBackgroundColour
unknown
plain_text
2 years ago
342 B
11
Indexable
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';
});
}
Editor is loading...
Leave a Comment