> Dear Mike it was not helpful
>
> I have a scenario where I am trying to get to a div located within an
> iframe from the parent using the jQuery $() selector. I have tried
> multiple things but seem to have no luck. I was wondering if anyone
> had some suggestions or some past issues with this.
To work with the IFrame's dom you must use the IFrame's document
object, not the document for it's parent. So you would do something
like this:
$(function() {
var f = $('#myIFrame')[0];
// wait for frame load event
f.attachEvent ? f.attachEvent('onload', cb) :
f.addEventListener('load', cb, false);
// onload callback for iframe
function cb() {
// get iframe's document
var doc = f.contentWindow ? f.contentWindow.document :
f.contentDocument ? f.contentDocument : f.document;
var $frameDiv = $('div#content',doc);
alert($frameDiv.html());
};
});