Windows Dev Center

EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

nextSibling property

Retrieves a reference to the next child of the parent for the object.

Syntax

JavaScript

p = object.nextSibling

 

Property values

Type: Object

the next sibling.

Standards information

Examples

This example uses the nextSibling property to obtain the next item in the list.


<!DOCTYPE html>
<html>
<head>
  <title>nextSibling</title>
</head>

<body>
  <ul>
    <li id="firstListItem">List Item 1</li>
    <li>List Item 2</li>
    <li>List Item 3</li>
  </ul>
  <script>
    // Get the text content of the list item labeled 'List Item 2':
    var textNode = document.getElementById('firstListItem').nextSibling;
    console.log(textNode.nextSibling.textContent);
  </script>
</body>
</html>

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
Reference
lastChild
Conceptual
About the W3C Document Object Model

 

 

Anzeigen:
© 2015 Microsoft