Thursday, April 28, 2011

How to access parent.document elements using JQuery in firefox?

For example:

$(elementid,top.document).attr(attributeName)

or

$(elementid,parent.document).attr(attributeName)

works in IE or Chrome but doesn't work in Firefox.

Does anyone know what the firefox equivalence is?

Thanks!

From stackoverflow
  • Try

    $(elementid,window.parent.frames[0].document).attr(attributeName)

    What are you trying to achieve - perhaps giving the question in context will get you better solutions.

    Ke : it doesn't work. I was trying to access an element outside an iframe from a click function called inside that iframe.
  • What about

    window.parent.$(elementid).attr(attributeName);

    Ke : it works! thanks!

0 comments:

Post a Comment