JavaScript node.isConnected Property

You are Here:

JavaScript node.isConnected Property

The node.isConnected property indicates whether the node is connected (directly or indirectly) to the context object.

Note: This property is read-only.

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <button onclick="check()">Check</button> <button onclick="connectNode()">Connect Node</button> <script> var node = document.createElement('p'); var text = document.createTextNode("Hello There"); node.appendChild(text); function check(){ if(node.isConnected) alert("<p> tag is connected"); else alert("<p> tag is NOT connected"); } function connectNode(){ document.body.appendChild(node); } </script> </body> </html>

Syntax

node.isConnected

Return Value

ValueExplanation
trueIf the specific node is connected to the context object.
falseIf the specific node is not connected to the context object.

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author