Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

find element that has certain text javascript

for (const a of document.querySelectorAll("a")) {
  if (a.textContent.includes("your search term")) {
    console.log(a.textContent)
  }
}

Or with a separate filter:

[...document.querySelectorAll("a")]
   .filter(a => a.textContent.includes("your search term"))
   .forEach(a => console.log(a.textContent))
Comment

PREVIOUS NEXT
Code Example
Javascript :: sum is not working in js 
Javascript :: perfect scrollbar jquery 
Javascript :: jquery get data element 
Javascript :: Removing borderline of input in react 
Javascript :: define methods of objects in javascript 
Javascript :: electron vue printer 
Javascript :: svg clientx 
Javascript :: node express config file json 
Javascript :: algolia docs react instant search 
Javascript :: How to loop through an object in JavaScript with the Object.keys() method 
Javascript :: express generator error handling 
Javascript :: javascript events 
Javascript :: string sort javascript 
Javascript :: content uri react native fs 
Javascript :: ForEach Element with Function or Lambda 
Javascript :: moment.js get time from now 
Javascript :: delete request reaxt 
Javascript :: how to get 6 months after date object 
Javascript :: next js get query parameters 
Javascript :: spotify uri 
Javascript :: how to create a dynamic function in javascript 
Javascript :: js variable to string 
Javascript :: ng-true-value 
Javascript :: set input type file value empty in react 
Javascript :: javascript catch all click events 
Javascript :: how to check request type in js 
Javascript :: upload photos cypress 
Javascript :: qr code generator with js 
Javascript :: send data using axios 
Javascript :: js indexof string 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =