I recently stumbled upon a little problem with an iframe. I tried finding some elements with jquery, but for some reason it can’t find inside an iframe. That’s why they (iframe developers) invented this method:
Given a jQuery object that represents a set of DOM elements, the
.contents()method allows us to search through the immediate children of these elements in the DOM tree and construct a new jQuery object from the matching elements. The
.children()methods are similar, except that the former includes text nodes as well as HTML elements in the resulting jQuery object.
.contents()method can also be used to get the content document of an iframe, if the iframe is on the same domain as the main page.