The consortium DOM properties and methods used to dynamically create content

Source: Internet
Author: User
Tags tagname
dom|w3c| Create | dynamic

Properties/Methods

Describe

Document.createelement (TagName)

The CreateElement method on a Document object can create elements that are specified by tagname. If a string div is used as a method argument, a DIV element is generated

document.createTextNode (text)

The createTextNode method of the Document object creates a node that contains static text.

<element>.appendchild (Childnode)

The 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 of a SELECT element.

<element>.getattribute (name)

<element>.setattribute (name)

These methods get and set the value of the Name property in the element, respectively.

<element>.insertbefore (Newnode,targetnode)

This method inserts the node newnode as a child of the current element in front of the targetnode element.

<element>.removeattribute (name)

This method deletes the attribute name from the element.

<element>.replacechild (Newnode,oldnode)

This method replaces the node OldNode with the NewNode node.

<element>.haschildnodes ()

This method returns a Boolean value indicating whether the element has child elements.

<element>.clonenode (True)

Clones the current element and returns a new element



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.