Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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";
  }
});
Comment

if text is present make div hide

<div class="test">
  Pakket
</div>
<div class="test">
  Handtekening
</div>
<div class="test">
  Thuis
</div>
Comment

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';
    }
}
Comment

if text is present make div hide

<div class="test">
     Pakket
</div>
<div class="test">
     Handtekening
</div>
<div class="test">
     Thuis
</div>
Comment

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";
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js similar jquery document ready 
Javascript :: mongoose get elements that contain substring 
Javascript :: js try..catch works synchronously. 
Javascript :: callback in js 
Javascript :: stale element reference: element is not attached to the page document 
Javascript :: JSX element event listeners 
Javascript :: remove duplicated from array 
Javascript :: how to update json key name while keeping the values in mysql 
Javascript :: switch into the postgres user windows 10 
Javascript :: how to get value of tinymce in javascript 
Javascript :: formdata 
Javascript :: javascript .target 
Javascript :: js extract boolean from string 
Javascript :: of() angular 
Javascript :: function expression javascript 
Javascript :: js method .sort 
Javascript :: useref in react 
Javascript :: transaction commit rollback nodejs 
Javascript :: faker js uuid example 
Javascript :: js date format 
Javascript :: use localstorage react hook 
Javascript :: svg clientx 
Javascript :: convert image url to base64 javascript without canvas 
Javascript :: write hello world in javaskript 
Javascript :: pagination react 
Javascript :: how to use react-native-vector-icons 
Javascript :: send json file to kafka topic 
Javascript :: openstreetmap api example javascript 
Javascript :: how to declare an array in javascript 
Javascript :: server smtp 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =