How to manipulate Dom in JS

Source: Internet
Author: User

1, ChildNodes

Returns an array of all child elements of the current element

2, FirstChild

Returns the first child element of the current element

3, LastChild

Returns the last child element of the current element

4, NextSibling

Returns the element immediately following the current element

5, NodeValue

Specify read/write properties that represent the value of an element

6, ParentNode

Returns the parent node of the element

7, PreviousSibling

Returns the element immediately preceding the current element

8, HasChildNodes ()

Returns a Boolean value indicating whether the element has child elements

9. createelement (Element)

Creating ELEMENT nodes

10, createTextNode ()

Create a text node

11, CloneNode ()

Creates a replica for a given node with a parameter of true or false,true to replicate the child nodes of the node at the same time, false to not copy the child nodes

12, AppendChild ()

Add a new child node to the specified node

13, RemoveChild ()

Delete child nodes

14, ReplaceChild ()

Replace child nodes

15, InsertBefore ()

Inserts a new child node in front of the specified child node

16, CreateAttribute ()

To create an attribute node

17, GetAttribute ()

Returns the specified property value

18, SetAttribute ()

Sets or modifies the specified property to the specified value

19, NodeName

will return a string whose content is the name of the given node

20, NodeType

Returns an integer that represents the type of the given node

How to manipulate Dom in JS

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.