How to access html element text in chrome devtools console

Home / Uncategorized / How to access html element text in chrome devtools console

Question:
I have a page with a whole bunch of blackquote tags. In dev console I am typing document.getElementsByTagName("blockquote") that giving me an array.

But if I do document.getElementsByTagName("blockquote").innerText document.getElementsByTagName("blockquote").innerHTML document.getElementsByTagName("blockquote").textContent document.getElementsByTagName("blockquote").outerText document.getElementsByTagName("blockquote").outerHTML

All return undefined

However if I inspect elements of the array document.getElementsByTagName("blockquote") I can see all above properties in place.

How to access at least one of them (innerText, outerHTLM, innerText, outerHTML, textContent) ?


Answer:
Or if you want to access any specific element you can use index in array
for (var i=0; i Read more

Leave a Reply

Your email address will not be published. Required fields are marked *