How can I create a search feature for an array of divs with no text content?

Is there a way to create a search filter for HTML elements based on their values, IDs, or names etc. the same way you can create a search filter based on the elements text content? Here is my search filter for divs with text content. Is there a way to implement the search filter if the divs have no text content? Am I able to access the elements tag and use that somehow?

Javascript filter based on text content

let input = document.querySelector(`#input`);
let animalDivs = document.querySelectorAll(`.animal`);

input.addEventListener(`keyup`, function(e) {
  const term = e.target.value.toLowerCase();
  animalDivs.forEach(function(div) {
    const animal = div.textContent.toLocaleLowerCase();
    if (animal.includes(term)) {
      div.style.display = "block"
    } else {
      div.style.display = "none"
    }
  });
});
<input type="text" id="input">
<div class="container">
  <div tag="The Monkey" id="monkey" class="animal">The Monkey</div>
  <div tag="The Mongoose" id="mongoose" class="animal">The Mongoose</div>
  <div tag="The Mouse" id="mouse" class="animal">The Mouse</div>
  <div tag="The Moose" id="moose" class="animal">The Moose</div>
</div>