Please tell me how to assign values to tags by their attributes:
- if the attribute is empty - the background is red
- if there is something in the attribute - the background is blue
Gives error all the time - Uncaught TypeError: elems.getAttribute is not a function
Is it possible to replace getAttribute with something else?
Thank you in advance!
function ifImgIsEmpty() {
    let elems = document.querySelectorAll('.card');
    let value = elems.dataset.databackgroundImage;
  
    for (let elem of elems) {
        if (elem.value === null && elem.value === '') {
            elem.style.background = "red";
        } else {
            elem.style.background = "blue";
        }
    }
  
};
ifImgIsEmpty();.card {
  display: flex:
  border: solid;
  padding: 2rem;
  background: #eee;
}<a href="" class="card" data-background-image="">01</a>
<a href="" class="card" data-background-image="blue">02</a>
<a href="" class="card" data-background-image="blue">03</a>
<a href="" class="card" data-background-image="">04</a>