Element nodetype values
Returned integer |
Node type constant |
1 |
Element_node |
2 |
Attribute_node |
3 |
Text_node |
4 |
Cdata_section_node |
5 |
Entity_reference_node |
6 |
Entity_node |
7 |
Processing_instruction_node |
8 |
Comment_node |
9 |
Document_node |
10 |
Document_type_node |
11 |
Document_fragment_node |
12 |
Notation_node |
General Chinese comparison table:
Dom Element Node nodetype Value
Integer |
Constant |
1 |
Element_node, a common element node, such as <HTML>, <p>, <div>, <span>, |
2 |
Attribute_node, element attribute |
3 |
Text_node: text node |
4 |
Cdata_section_node, that is, <! [CDATA []> |
5 |
Entity_reference_node, object reference, such as & amp; & nbsp; |
6 |
Entity_node, entity, such as <! Entity copyright "Copyright 2010, impng. All Rights Reserved"]> |
7 |
Processing_instruction_node, PI, Processing Command, as shown in <? XML version = "1.0"?> |
8 |
Comment_node, comment <! -> |
9 |
Document_node, the root node, that is, document. nodetype |
10 |
Document_type_node, DTD, document type <! Doctype> |
11 |
Document_fragment_node, file segment |
12 |
Notation_node, the mark defined in DTD |
Note that in IE, spaces/TAB/line breaks in HTML are directly skipped, while spaces in Firefox are considered to be a node. ThereforeNextsiblingOrPreviussiblingYou need to determine whether it is an element node.
1234 |
var el = $(
'#demo' ); do {
el = el.nextSibling; } while (el.nodeType != 1); |