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 7863191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:24:22+00:00 2026-06-02T23:24:22+00:00

How i can select all child in a parent div with deference child level

  • 0

How i can select all child in a parent div with deference child level in jQuery?

For example i want to get all myDiv1 input, Not myDiv2:

<div id="myDiv1">
   <input name="child1"/><!-- level 1 -->
   <p><input name="child2"/></p><!-- level 2 -->
   <div><p><input name="child3"/></p></div><!-- level 3 -->
</div>

<div id="myDiv2">
   <input name="child1"/><!-- level 1 -->
   <p><input name="child2"/></p><!-- level 2 -->
   <div><p><input name="child3"/></p></div><!-- level 3 -->
</div>

I tested $(‘#mydiv1 input’) OR $(‘#mydiv1 > input’) but not working.

  • 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-06-02T23:24:23+00:00Added an answer on June 2, 2026 at 11:24 pm

    $('#mydiv1 input') will select all input elements which are inside #mydiv1 – no matter how deep.

    $('#mydiv1 > input') will only select input elements which are direct children of #mydiv1 (i.e. child1)

    If that doesn’t work for you, something else is wrong with you code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I select all id's for records in single cell? For example: --example
I'm using jQuery's dynaTree in my application and I want to select the all
I have a DOM in the form of <input class=parent></div> <input class=child></div> <input class=child></div>
In my Parent Child scenario, I need to get the custom list of all
I am using the following Expression to select all hyperlinks //a[@href] How can I
I need to grant privileges to all users, I can do: GRANT select on
SELECT name FROM sys.databases -- this can list all database name in the server
I can select the first item in the div using $('.class:first') Now since I
[Previous essay-title for question] Oracle SQL: update parent table column if all child table
I am trying to get all the form elements within a specific div, and

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.