To get elements by tag name in jQuery, do $('tagName') Also, I suggest you do "feature detection" instead of "browser detection", as described here: http://www.quirksmode.org/js/support.html
What I mean is, try something like this: var frame = $('iframe')[0]; var frameDocument; if(frame.contentDocument && frame.contentDocument.documentElement) { frameDocument = frame.contentDocument.documentElement; } else if(document.frames[0] && document.frames[0].document) { frameDocument = document.frames[0].document; } ... Also, you can use frameDocument as a context to select stuff from the iframe page: $('#someElementInIFrame', frameDocument).bind('click', ...); Hope it helps. --Erik On 8/8/07, julio <[EMAIL PROTECTED]> wrote: > > I solved with this: > > function doBind() { > var frame; > if ($.browser.msie) { > frame = document.frames[0].document; > } else { > frame = document.getElementsByTagName("iframe") > [0].contentDocument.documentElement; > } > $(frame).bind('click', function(event) { alert('an element in frame > is clicked ' + event.target.innerHTML) }) > } > > > Is there a "wrap" of jquery for above if/else? Or more generic > question, is there a "wrap" to get a iframe/frame in jquery? > > I'm searching in jquery docs but I have not found anything again > > On Aug 8, 10:32 am, julio <[EMAIL PROTECTED]> wrote: > > Ok thanks:) it works > > > > but I'm interested to "touch" less possible sample.html. > > > > And so I have tried this in main.html: > > > > function doBind() { > > var frame=document.getElementsByTagName("iframe") > > [0].contentDocument.documentElement; > > $(frame).bind('click', function(event) { alert('an element in frame > > is clicked ' + event.target.innerHTML) }) > > > > } > > > > it would be a kind of "addEventListener" (using jquery-bind). > > On firefox 2.0.x it works but I suppose it's not good for explorer > > because is present 'contentDocument.documentElement' > > > > Have you any idea to make it "cross-browser"??? > > > > Thanks, > > Julio > >