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

后端 未结 4 1568
春和景丽
春和景丽 2020-12-24 06:01

For example:

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

or

$(elementid,parent.document).attr(attributeName)
相关标签:
4条回答
  • 2020-12-24 06:42

    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.

    0 讨论(0)
  • 2020-12-24 06:44

    What about:

    window.parent.$(elementid).attr(attributeName);
    
    0 讨论(0)
  • 2020-12-24 06:55

    And don't forget document.domain = "yourdomain.com" before running $(selector, parent.document) because I ran into "access denied" issues just like location.href for iframes

    0 讨论(0)
  • 2020-12-24 06:59

    Try this:

    $("#myid", top.document); 
    

    or

    $("#myid", parent.document.body); 
    

    Ref

    0 讨论(0)
提交回复
热议问题