How to access parent iframe elements from a child javascript page?

后端 未结 6 2148
说谎
说谎 2020-12-19 02:55

I have 2 pages: Parent and child.

In the parent page I have an iframe whose value I want to fetch in the JavaScript of child page. Is there any way?....Please suggest

6条回答
  •  悲&欢浪女
    2020-12-19 03:34

    You can use

    window.parent.getElementById('YOUR ID').value();
    

    to get the value from the input element with the id "YOUR ID" from the parent.

提交回复
热议问题