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
) ?
Or if you want to access any specific element you can use index in array
for (var i=0; i <document.getElementsByTagName("blockquote").length; i++ ){
var singleElement = document.getElementsByTagName("blockquote")[i];
console.log(singleElement.innerHTML);
}