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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:40:58+00:00 2026-05-28T18:40:58+00:00

Pretty straightforward. I think I have what should be a unique selector, but in

  • 0

Pretty straightforward. I think I have what should be a unique selector, but in Chrome it returns two <p> elements. The page I’m looking at is:

http://docs.webfaction.com/user-guide/control_panel.html

and the selector is:

document.querySelectorAll('body:nth-child(2) div#container:nth-child(1) div#content.clear.hasCorners:nth-child(2) div.document:nth-child(3) div.documentwrapper:nth-child(1) div.bodywrapper:nth-child(1)  div.body:nth-child(1) div#the-control-panel.section:nth-child(1) p:nth-child(3)')

I must be misunderstanding something about the nth-child selector because I would think this is guaranteed to be unique.

EDIT: Ah, I should definitely be using some child selectors (>) here to avoid going further down the DOM tree. Someone can feel free to answer it with that and I’ll accept.

  • 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-28T18:40:59+00:00Added an answer on May 28, 2026 at 6:40 pm

    As noted above, the issue is that without the child selector (>) there’s no guarantee of uniqueness because there may be additional matches further down the DOM tree. For instance consider this markup:

    <body>
      <div class="foo" id="bar">
        <div class="foo" id="baz"></div>
      </div>
    </body>
    

    if you tried:

    $('body:nth-child(1) .foo:nth-child(1)')
    

    that would return two elements.

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

Sidebar

Related Questions

This should be pretty straightforward I would think. I have this string: [quote=Joe Johnson|1]Hi![/quote]
I'm trying to do something that I think should be pretty straightforward but I
Pretty straightforward, but I just want to know which is faster. I think simply
Okay at first I thought this would be pretty straightforward. But I can't think
Pretty straightforward: I'm looking to do the same as this but in winforms. Everything
I have a pretty straightforward (one would think) task. Pass a value to a
This should be a pretty straightforward issue -- I'm trying to compile Lua (or
I have legacy win.forms application written in pretty straightforward approach where forms communicate with
I know similar questions have been asked before, but I think my solution is
i think this is a pretty straight forward problem , but i still can

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.