Untitled
unknown
plain_text
2 years ago
381 B
5
Indexable
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();
Editor is loading...