NextSibling Property: This property represents the next node of the current node, and if there is no node with its sibling, the Null;previoussibling property is returned: This property is the opposite of the NextSibling property, which is described in detail next, Interested in you may wish to know the next Oh, may be helpful to you
1:nextsibling Property This property represents the next node of the current node (the node that follows is the same level as the current node), or null if there are no nodes with its siblings.
It is important to note that this property does not perform the same results in different browsers, as shown in the following example:
Let's look at an example:
<body>
<div> </div>
<input id= "A4" type= "button" onclick= "alert (this.nextsibling);" value= "D"/>
<input id= "A5" type= "button" onclick= "alert (this.nextsibling);" value= "E"/>
</bod
On the structure surface of the object, the DIV's nextsibling has only 2 items--two input nodes. But there are actually 5 items of--/n,input,/n,input,/n. This is because input acts as a label for creating various form input controls, whether it is generating a button, a checkbox, a radio ... or other form controls, IE automatically creates a 1-byte space behind it.
IE will skip the space between nodes (e.g., newline characters), and Mozilla will not do this--ff the layout elements such as whitespace wrapping are treated as node reads, so the next node element can be read in IE using nextsibling. This is what you need to write in FF: nextsibling.nextsibling.
Opera and Safari treat nextsibling in the same way as FF
2:previoussibling Property
This property has the opposite effect as the NextSibling property. For example: SomeTagObject.nextSibling.previousSibling actually returns the label element itself, but only if the tag element must have a sibling element behind it, or null is returned.
3: Attribute problem of HTML tag element object obtained by nextsibling or previoussibling
It is generally known by Nextsibling.nodename to know its label name, or by Nextsibling.nodetype to know its label type, and then, if the Nextsibling.nodename = #text, The text value is learned by Nextsibling.nodevalue, otherwise it can be obtained by using other common tag element properties such as nextsibling.innerhtml.
JS nextsibling Properties and PreviousSibling Properties Overview and usage notes