X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR BOOTSTRAP XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

HTML DOM importNode() Method

Document Object Reference Document Object

Example

Return the first H1 element that appears in an iframe:

var frame=document.getElementsByTagName("iframe")[0]
var h=frame.contentWindow.document.getElementsByTagName("h1")[0];
var x=document.importNode(h,true);

Try it yourself »


Definition and Usage

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 will also be imported.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The importNode() method is supported in all major browsers.

Note: Internet explorer 8 and earlier does not support this method.


Syntax

document.importNode(node,deep)

Parameters

Parameter Type Description
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

Type Description
Node object The imported node

Technical Details

DOM Version Core Level 2 Document Object


Document Object Reference Document Object


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE

facebook