JavaScript DOM Node

Source: Internet
Author: User

    • The entire document is a document node
    • Each HTML element is an element node
    • text within an HTML element is a text node
    • Each HTML attribute is an attribute node
    • Comment is a comment node
    • attribute and text nodes belong to the child nodes of the element node, so when you do so, you need to select the element nodes before modifying the properties and text.

Through the HTML DOM, all nodes in the tree can be accessed through JavaScript, all HTML elements (nodes) can be modified, or nodes can be created or deleted.

HTML DOM Methods

CreateAttribute () Creating an attribute node

createelement () Creating ELEMENT nodes

createTextNode () Creating a text node

AppendChild () Adds a new node to the specified node

InsertBefore () Inserts a new child node in front of the specified child node

RemoveChild () Delete child nodes

ReplaceChild () Replace child nodes

GetAttribute () returns the specified property value

SetAttribute () sets the specified property to or modifies the specified value

  

HTML DOM Properties

InnerHTML gets the text value of the node

The InnerHTML property is useful for getting or replacing the contents of an HTML element

ParentNode Gets the parent node of the node

ChildNodes getting the child nodes of a node

Attributes gets the node's attribute node

FirstChild returns the first child node

   

JavaScript DOM Node

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.