View Full Version : Selecting DOM Nodes inside iframe

21 Aug 2007, 4:38 AM
Hi all,

I need to do something like this:


where highlight is just an example. The problem is that I need to do that not in the main window but in an iframe.

The other posibility is to use Ext.get() for a list of my elements in the iframe but I would prefer not to use a loop if possible.

Any suggestion?

Thanks in advance, Neo.

21 Aug 2007, 6:01 AM
This is untested, but it should work:

var iframeBody = document.getElementById('iframe_id').contentWindow.document.body;

23 Aug 2007, 12:56 AM
Hi Nullity,

it really helped. It work with a small change in the first line of the code:

var element = window.frames['name_of_iframe'].document.body;

Ext.get(element).select('p').on('click', ElementClicked);

I may add that the second line of the code above works in ext 1.1 but it does not work in ext 1.0.1