Home >Web Front-end >Front-end Q&A >What are the methods for reading nodes in jquery?
The methods for reading nodes are: 1. "jQuery.parent(expr)"; 2. "jQuery.children(expr)"; 3. "jQuery.contents()"; 4. "jQuery. prev()"; 5. "jQuery.next()" and so on.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
jquery Get node method
jQuery.parent(expr)
Find the parent node, You can pass in expr for filtering, such as $("span").parent()
or $("span").parent(".class")
jQuery.parents(expr)
Similar to jQuery.parents(expr), but it searches all ancestor elements, not limited to parent elements
jQuery.children(expr)
Returns all child nodes. This method will only return direct child nodes and will not return all descendant nodes
jQuery.contents()
Returns all content below, including nodes and text. The difference between this method and children() is that including blank text will also be returned as a
jQuery.prev()
Previous sibling node, not all sibling nodes
##jQuery.prevAll()
jQuery.next()
jQuery.nextAll()
Return Brothers and sisters nodes, regardless of front and back
The above is the detailed content of What are the methods for reading nodes in jquery?. For more information, please follow other related articles on the PHP Chinese website!