Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

nodeType property

Retrieves the type of the requested node.

Syntax

JavaScript

p = object.nodeType

Property values

Type: Integer

1

Element node.

3

Text node.

Standards information

Remarks

If the node represents an attribute retrieved from the attributes collection, the nodeType returns null.

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

a
abbr
address
area
attribute
b
base
bdo
bgSound
blockQuote
body
br
button
caption
cite
code
col
colGroup
comment
dd
del
dfn
div
dl
documentType
dt
em
embed
fieldSet
form
frame
head
hn
hr
html
i
iframe
img
input type=button
input type=checkbox
input type=email
input type=file
input type=hidden
input type=image
input type=number
input type=password
input type=radio
input type=range
input type=reset
input type=search
input type=submit
input type=tel
input type=text
input type=url
ins
kbd
label
legend
li
link
map
menu
object
ol
option
p
pre
ProcessingInstruction
q
s
samp
script
select
small
span
strong
sub
sup
table
tBody
td
textArea
TextNode
tFoot
th
tHead
title
tr
u
ul
var
About the W3C Document Object Model

 

 

Show:
© 2014 Microsoft. All rights reserved.