How to get Dom from JS

Source: Internet
Author: User
Tags tag name

/tr>
interface NodeType Quantity NodeType value remarks
"> Element Node.element_node 1 element node
Text Node.text_node 3 text node
Document Node.document_node 9 document
Comment Node.comment_node 8
DocumentFragment
Attr Node. Attribute_node 2 node properties

method description
CreateAttribute ()
Createcomment () Creates a new comment node with the specified string.
createelement () Creates a new element node with the specified tag name.
createTextNode () Creates a new Textnode node with the specified text.
getElementById () Returns the element node in the document with the specified ID attribute.
getElementsByTagName () Returns all the element nodes in the document with the specified tag name.

" description
attributes If the node is an element, the attribute of the element is returned in namednodemap form.
childnodes
FirstChild
LastChild node Returns the last child node of the current node. Null if there are no child nodes.
nextSibling Next sibling node
nodename The name of the node, the element node represents the tag name of the element.
NodeType class that represents the node Type.
parentnode parent node of the current node. Null if there is no parent node.
previoussibling Returns the sibling node, which is close to the current node, before it. If there is no such node, NULL is returned. Previous sibling node

method description
AppendChild ()
CloneNode () copy when The front node, or copy the current node and all its descendants.
HasChildNodes () If the current node has child nodes, it returns true.
InsertBefore ()
RemoveChild ()
ReplaceChild ()

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.