Home >Web Front-end >Front-end Q&A >What are the methods for reading nodes in jquery?

What are the methods for reading nodes in jquery?

青灯夜游
青灯夜游Original
2021-11-15 16:45:092266browse

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.

What are the methods for reading nodes in jquery?

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()

    Returns all previous sibling nodes

  • jQuery.next()

    Returns the next sibling node, not all sibling nodes

  • jQuery.nextAll()

    Return all subsequent sibling nodes

  • ##jQuery.siblings()

    Return Brothers and sisters nodes, regardless of front and back

  • Recommended related video tutorials:
jQuery tutorial

(video)

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn