Js / jquery / html: getting div from iframe

How can I grab a div from an iframe into a JS variable? You don't have to use jQuery.

+1


a source to share


2 answers


document.getElementById('IframeId').contentWindow.document.getElementById('DivId');

      



+9


a source


In jQuery syntax it would be $('iframe').contents().find('div')

. (Please replace any specific identifiers / classes / other selectors you need). Tracker1's answer should work fine for standard Javascript.



+9


a source







All Articles