nodeType property
[This documentation is preliminary and is subject to change.]
Retrieves the type of the requested node.
Syntax
| JavaScript | |
|---|
Property values
Type: Integer
Standards information
- Document Object Model (DOM) Level 1 Specification, Section 1.2
Remarks
If the node represents an attribute retrieved from the attributes collection, the nodeType returns null.
Starting in Microsoft Internet Explorer 6, this property applies to the attribute object.
Examples
This example assigns the nodeType property of the body object to a variable.
var iType = document.body.nodeType;
This example assigns the nodeType property of a node created with the createElement method to a variable.
var oNode = document.createElement("B");
document.body.insertBefore(oNode);
var iType = oNode.nodeType;
See also
- Attr Constructor
- a
- abbr
- acronym
- address
- applet
- area
- attribute
- b
- base
- baseFont
- bdo
- bgSound
- big
- blockQuote
- body
- br
- button
- caption
- center
- cite
- code
- col
- colGroup
- comment
- dd
- del
- dfn
- dir
- div
- dl
- documentType
- dt
- em
- embed
- fieldSet
- font
- form
- frame
- frameSet
- head
- hn
- hr
- html
- i
- iframe
- img
- input type=button
- input type=checkbox
- input type=file
- input type=hidden
- input type=image
- input type=password
- input type=radio
- input type=reset
- input type=submit
- input type=text
- ins
- kbd
- label
- legend
- li
- link
- listing
- map
- marquee
- menu
- nextID
- object
- ol
- option
- p
- plainText
- pre
- ProcessingInstruction
- q
- s
- samp
- script
- select
- small
- span
- strike
- strong
- sub
- sup
- table
- tBody
- td
- textArea
- TextNode
- tFoot
- th
- tHead
- title
- tr
- tt
- u
- ul
- var
- xmp
- Element Constructor
- HTMLDocument Constructor
- Text Constructor
- About the W3C Document Object Model
Build date: 2/14/2012