DocumentFragment typeCustomOf all the node types, only documentfragment does not have a corresponding tag in the document. The DOM rules document fragment (Doc fragment) is a "lightweight" document that can contain and control nodes, but does not
HTML Dom tutorial 6-html Dom node Information
1: node Information
Each node has attributes related to certain node information. These attributes are:
Nodename (node name)
Nodevalue)
Nodetype (node type)
2: nodename
The
HTML Dom tutorial 3-html Dom node (node)
1: Concepts and types of nodes
According to the Dom, each component in the HTML document is a node.
There are five types of nodes in DOM:
The entire document isDocument Node
Each HTML tag
Add instruction Node
Every valid XML must contain Processing Instruction. XML is widely used for HTML, SVG, XLS etc. so make sure your xml file has valid instruction of its type and encoding. the following line is a sample XML Processing
Javascript: DOM node (new HTML element/delete HTML element), javascriptdom
You can use DOM to Create HTML elements or delete existing HTML elements.
Code organized from w3school: http://www.w3school.com.cn
(1) New element:
(2) Deleting HTML
Empty, remove, and jquerydom for DOM Node Deletion in jQuery
Preface
I just learned new things recently. Although it is a small knowledge point, I can't help but share it with you. The content of this article is mainly for beginners. If you have any
Summary of DOM Node Deletion methods in jQuery (ultra-Comprehensive), jquerydom
Preface
As we all know, removing a node from a page is a common operation for developers. jQuery provides several different methods to solve this problem. The following
Learn from the Dark Horse course and share a little practice of node manipulation in JS Dom hereRequirement: Use JS to create a 4*3 table.onload =function(){ functionC (tagName) {returndocument.createelement (tagName); } varTable = C ('
First, create a nodevar box = $ (' node '); Create a Node$ (' body '). appended (box); Inserting a node into the element interiorSecond, insert the nodeInternal Insertion Node methodAppend (content) Inserts a node after the specified element
This section focuses on the common operations of HTNL DOM, including creating nodes, finding nodes, inserting nodes, moving nodes, deleting nodes, and so on.Next, the specific code:The comments in the code include some of the points of knowledge
Operations Node
Add a new child node to the end of the node's child node listSomenode.appendchild (newchild)
ExampleThe following function inserts a new segment at the end of the document:
The code is as follows
Copy Code
The example in this article describes the way jquery deletes a DOM node. Share to everyone for your reference. The specific analysis is as follows:
If an element in your document is superfluous, you should delete it. jquery provides two ways to
This article describes the DOM node depth cloning function clonenode () usage. Share to everyone for your reference.
The implementation methods are as follows:
Copy Code code as follows:
Spring
Summer
I. Operation of the node 1. Find the node: var $var _1=$ ("Htmltype"); The phrase is to get all the Htmltype nodes such as: Var $ul _1=$ ("ul"); 2. Create and APPEND nodes: var $var _1=$ ("");//The phrase is to create a node $ ("Htmltype2"). Append (
getElementById (ID)This is one of the most common examples of accessing an element through an ID:test Note: If the ID of the element is not unique, then the first element of that ID name will be taken
Getelementsbyname (name)This is done by name
Trigger dom node Event code manually to trigger dom nodes
During code crawling, I encountered a strange problem. You need to manually modify the select value and then manually trigger the select change event. However, the trigger triggered by the
The following example takes this HTML document structure as an example: Document Get a collection of child nodes: ChildNodes ()var ul = document.getElementById ("contents"); for (var i= 0; i Operation Result:li_1
1, creating elementsDocument.createelement (' element name to create ');2. Inserting nodesAppendChild and InsertBefore3. Delete a nodeRemoveChild usage removechild (' which node is to be deleted ');Example, the comparison of the two nodes, and the
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.