PA filter

mail@pastecode.io avatar
unknown
javascript
a year ago
494 B
22
No Index
Never
function removeElements(criteria, string) {
  // Select all elements on the page that match the criteria
  var elements = document.querySelectorAll(criteria);

  // Remove each element that contains the specified string
  for (var i = 0; i < elements.length; i++) {
    if (elements[i].innerHTML.includes(string)) {
      elements[i].remove();
    }
  }
}

// Example usage: remove all elements with the class "text" that contain the string "spam"
removeElements("#resultados > div", "2.5 km");