Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
381 B
3
Indexable
Never
function detectDivsWithText() {
  const divElements = document.querySelectorAll('div');
  
  for (let i = 0; i < divElements.length; i++) {
    const div = divElements[i];
    
    if (div.textContent.includes('Escribe algo')) {
      console.log(div);
      // Do something with the matching div element
    }
  }
}

// Call the function to execute the code
detectDivsWithText();