Sara Chipps Sara Chipps - 4 months ago 9
jQuery Question

Return all page iFrames without id element

I tried this the intuitive way with both JavaScript and jQuery, with no dice for either.

document.GetElementsByTagName('iframe');


got me:


Uncaught TypeError: Object # has no method
'GetElementsByTagName'


and
$('iframe')

got me
undefined
.

Is an iframe an element? Is there a way to do this?

I'm trying to return all the page iframes.

Thank you.

Joe Joe
Answer

The function needs a lower case g like so document.getElementsByTagName('iframe') . Yes, iframe is a tag. https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByTagName