Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6919473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:59:40+00:00 2026-05-27T09:59:40+00:00

In the jQuery documentation for the child selector I saw this note: Note: The

  • 0

In the jQuery documentation for the child selector I saw this note:

Note: The $("> elem", context) selector will be deprecated in a future release. Its usage is thus discouraged in lieu of using alternative selectors.

I use this pattern all the time, usually like this:

$nodes.find('> children[something=morecomplicated] > somethingelse');

However, I don’t understand what the “alternative selectors” they refer to could be. What is the right way to write a selector which traverses the immediate children of a context node? As a bonus, can anyone explain why this is depreciated? All the alternatives everyone is giving seem amazingly ugly.

Here are some things that don’t work:

// does not guarantee that '.child' is an immediate child
$nodes.find('.child > .grandchild');

// this will return empty array in recent jQuery
// and will return full list of children in older jQuery
$nodes.children('.child > .grandchild');

// Anything like this which forces you to split up the selector.
// This is ugly and inconsistent with usual selector ease-of-use,
// and is a non-trivial conversion for long or complex selectors.
$nodes.children('.child').children('.grandchild');
// After all, no one would ever recommend
$nodes.find('.this').children('.that');
// instead of
$nodes.find('.this > .that');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:59:41+00:00Added an answer on May 27, 2026 at 9:59 am

    The reason they are saying:

    Note: The $("> elem", context) selector will be deprecated in a future release. Its usage is thus discouraged in lieu of using alternative selectors.

    Is due to the comma followed by the context in the selector. E.g. $("> elem") is fine however, $("> elem", context) will be deprecated.

    $("> elem", context) is the same as $(context + "> elem").

    A correct way of obtaining children and grandchildren is

    $("elem").children('.child').children('.grandchild');
    

    or

    context.children('.child').children('.grandchild');
    

    or

    context.find('> .child > .grandchild');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I saw on the jquery documentation that live() is deprecated. Is there a direct
I'm trying to find a jQuery selector that will match only the element that
From the jQuery documentation on JavaScript types comes this snippet of code describing the
Can anyone explain what the jquery documentation is exactly referring to with this statement:
I looked at JQuery documentation , read FAQ and saw a lot of examples.
I really did try Google and jQuery documentation for this and I give up.
I always see this in the documentation. $('.selector').draggable({ start: function(event, ui) { ... }
Reading through the jQuery documentation about the event object and its constructor $.Event() I
I'm using this plugin to replace jQuery's imgload event with one that will fire
The jQuery documentation covers the function jQuery.extend()s twice, giving it different definitions. The first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.