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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:11:20+00:00 2026-06-13T20:11:20+00:00

I need to select all the list items in all unordered lists where the

  • 0

I need to select all the list items in all unordered lists where the count is greater than seven.

This code:

$("ul.seven > li:gt(6)").hide()

is too greedy and works correctly for the first unordered list on the page but hides all subsequent list items of subsequent unordered lists. What is the correct selector?

  • 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-13T20:11:21+00:00Added an answer on June 13, 2026 at 8:11 pm

    :gt() collates the entire set of ul.seven > li and picks everything after the sixth li in that combined set, regardless of its parent. It’s equivalent to selecting all of those li elements and then performing a .slice() on the result set:

    $("ul.seven > li").slice(7).hide();
    

    Which does something very different from what you expect.

    You want :nth-child() instead, which behaves more like what you expect of a CSS simple selector:

    $("ul.seven > li:nth-child(n+8)").hide();
    

    :nth-child(n+8) means “starting from the 8th child based on a 1-index”, which is roughly equivalent to :gt(6) which means “starting from the 7th match based on a 0-index” (confusing, I know). Compare the Selectors spec for :nth-child(), the jQuery API documentation for :gt() and the jQuery API documentation for .slice().

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

Sidebar

Related Questions

The below JS is selecting all of the list items, i need to select
I am using Listbox for display a list. I need select all above item
I have code that adds list items to an unordered list, and associated with
I have 2 select lists ausers - List all available users susers - Displays
I need to select all from table1 where active=1 and replace t1cid,t2cid,L1cid,L2cid---L10cid with corresponding
I need to select all entries between two given dates (Nov 10 and Jan
I need to select all columns from two tables, but need to be able
I have one scenario where I need to select all files having aliencoders.numeric-digits like
I am using SQL Server 2008 and I need to select all data from
I need a mysql query which will select all rows that contain joe in

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.