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

  • Home
  • SEARCH
  • 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 305455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:22:30+00:00 2026-05-12T07:22:30+00:00

my html <div id=x> <div id=x1> some text <div>other text</div> </div> <div id=x2>just text</div>

  • 0

my html

<div id="x">
  <div id="x1">
    some text
    <div>other text</div>
  </div>
  <div id="x2">just text</div>
<div>

my call

I have this element than can be any jquery selector, 1 or more elements:

var x = $("#x");

now I NEED (this is a plugin who will discover inner elements like tabs) to navigate only thru the firsts DIV elements and not its childrends. I’m trying…

$.each($($("div"), x), function() {
  alert($(this).html());
});

shows:
1. some textother text
2. other text
3. just text

$.each($($("div"), x).siblings(), function() {
  alert($(this).html());
});

shows:
1. just text
2. some textother text

this is the most approximate, but I need in the correct order. any suggestion ? thanks

ps. because it’s a plugin I cant do this.

$("#x", "div....")

I need to do this

#(newselector, x)
  • 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-12T07:22:31+00:00Added an answer on May 12, 2026 at 7:22 am

    If you cannot use $("#x > div") because it should work with all selectors you think of then assuming you defined that specific selector to var x:

    var x = $('#x');
    
    // this will select only the direct div children of x whatever the x is
    x.children('div');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
I have the following html <div class=someClass> Some text </div> <div class=someClass> Some other
I have this html code: <div class=action> some_text <a class=delete_action name=q1>some</a> </div> <div class=action>
I have a jquery line of code that outputs some HTML to a div.
I have some html like the following: <div class=control-group> <input type=text data-bind=value: $data.DealCode name=DealCode
In a DIV I place some text/html code which get loaded from a database.
I have HTML like this: <div> <a href=>sometext<img src=images/001.jpg /></a> <a href=>sometext<img src=images/002.jpg /></a>
I am dealing with some HTML text that I basically have read access to.
I'm working through some javascript examples, and I just did this one: <!DOCTYPE html
Hi just looking for some direction, I have a HTML form which has several

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.