I'm trying to find a class on a div (where the value will always end in 0bg), given a partial string, and then get its background style value.
For example:
.xx-color-100bg{
background-color: #323334;
}
<div class="heading xx-color-100bg"></div>
document.querySelectorAll(".heading").classList.contains("0bg").style.background
The solution above errors with Cannot read properties of undefined (reading 'contains')
How can I find the necessary class and grab it's background-color value?
querySelectorAll()returns a NodeList.classListis undefined on NodeList (it is found on a DOMElement.querySelectorAll('[class$="0bg"]')".heading[class$='0bg']"