Dom manipulation of JavaScript

Source: Internet
Author: User
Tags tag name tagname unique id

Dom manipulation of JavaScript

ChildNodes returns an array of all child elements of the current element
FirstChild returns the first subordinate child element of the current element
LastChild returns the last child element of the current element
NextSibling returns the element immediately following the current element
NODEVALUE Specifies the read/write property that represents the value of the element
ParentNode returns the parent node of the element
PreviousSibling returns the element immediately preceding the current element


getElementById (ID) (document) Gets the element with the specified unique ID property value in the document
Getelementsbytagname_r (name) returns an array of child elements in the current element with the specified tag name
HasChildNodes () returns a Boolean value indicating whether the element has child elements
GetAttribute (name) returns the attribute value of the element, which is specified by name


The Createelement_x method on the document.createelement_x (tagName) Document object can create an element that is specified by the tagName. If a string div is used as a method parameter, a DIV element is generated
The createTextNode method of the document.createTextNode (text) Document object creates a node that contains static text
The. appendchild (Childnode) AppendChild method adds the specified node to the list of child nodes of the current element (as a new child node). For example, you can add an option element as a child node of a SELECT element
. getattribute (name)
. SetAttribute (name, value) These methods obtain and set the value of the Name property in the element, respectively
. insertbefore (NewNode, TargetNode) This method inserts the node newNode as a child of the current element in front of the TargetNode element
. RemoveAttribute (Name) This method removes the attribute from the element name
. RemoveChild (Childnode) This method removes the child element from the element Childnode
. ReplaceChild (NewNode, OldNode) This method replaces the node OldNode with the node NewNode
. HasChildNodes () This method returns a Boolean value indicating whether the element has child elements

Dom manipulation of JavaScript

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.