Return the first <h1> element that appears in an iframe (another document):
The importNode() method imports a node from another document.
The imported node can be of all node types.
If the second parameter is set to true, the nodes's child nodes (descendants) will also be imported.
Note: The original node is not removed from the other document. The imported node is a copy of the original.
Tip: Use the document.adoptNode() method to remove and import a node from another document.
Tip: Use the element.cloneNode() method to copy a node from the current document.
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
importNode() | Yes | 9.0 | 1.0 | Yes | 9.0 |
Parameter | Type | Description |
---|---|---|
node | Node object | Required. The node from another document. Can be of any node type |
deep | Boolean | Required. If set to false, only the node itself is imported, if set to true, all child nodes (descendants) are also imported |
Return Value: | A Node object, representing the imported node |
---|---|
DOM Version | Core Level 2 Document Object |