Parent page code
iframe page code
Untitled Document <script> <br>$("body",parent.document).append('hahaha' ); <br></script>
iframe test--@mybest
There is such a record in the jQuery documentation:
jQuery(html, [ownerDocument])
Parameters
html String
HTML used to dynamically create DOM elements Mark string
ownerDocument (optional) Document
Create the document where the DOM element is located
You still need to read more and read the document carefully. It is really the saying: read the book a hundred times , its meaning is self-evident!
------Additional note--------------------------
During testing, I found that chrome could not achieve the above requirements. Later, I saw someone on the Internet pointing out that iframes cannot cross domains. This is one of the problems. Another reason is to put it into a site for testing
For example: http:// localhost:8087/test.html
In this way, chrome will behave normally