Answers for "if text is present make div hide"

0

if text is present make div hide

var divs = document.querySelectorAll(".test");
Array.from(divs).forEach(function(div) {
  if (div.textContent.indexOf("Handtekening") >= 0 || div.textContent.indexOf("Thuis") >= 0) {
    div.style.display = "none";
  }
});
Posted by: Guest on March-24-2021
0

if text is present make div hide

<div class="test">
     Pakket
</div>
<div class="test">
     Handtekening
</div>
<div class="test">
     Thuis
</div>
Posted by: Guest on March-24-2021
0

if text is present make div hide

<div class="test">
  Pakket
</div>
<div class="test">
  Handtekening
</div>
<div class="test">
  Thuis
</div>
Posted by: Guest on March-24-2021
0

if text is present make div hide

let filteredOut = ['Handtekening', 'Thuis'];

Array.from(document.querySelectorAll(".test")).forEach((elm) => {
 if(filteredOut.includes(elm.textContent.trim())) elm.style.display = "none";
});
Posted by: Guest on March-24-2021
0

if text is present make div hide

let divs = document.getElementsByClassName('test');

for (let x = 0; x < divs.length; x++) {
    let div = divs[x];
    let content = div.innerHTML.trim();

    if (content == 'Handtekening' || content == 'Thuis') {
        div.style.display = 'none';
    }
}
Posted by: Guest on March-24-2021

Code answers related to "if text is present make div hide"

Code answers related to "Javascript"

Browse Popular Code Answers by Language