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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:37:10+00:00 2026-06-08T05:37:10+00:00

I have a stack of divs that belong to a specific class, say tabs.

  • 0

I have a stack of divs that belong to a specific class, say tabs. and the semantic structure looks something like this:

<div class = "tabs" >_______</div>
<div class = "tabs" >_______</div>
<div class = "tabs" >_____</div>

It’s easy to access the first and the last element of the div like

$('.tabs:first') or
$('.tabs:last')

but getting to the 2nd (and assuming there are multiple other divs inside then the all divs other than first or last) seems to yield a syntax error to me such as :

$('.tabs:second') or $('.tabs:third') do not work expectedly.

Can anyone pinpoint what is wrong here?

  • 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-08T05:37:12+00:00Added an answer on June 8, 2026 at 5:37 am

    Take a look at the jQuery :first selector documentation:
    http://api.jquery.com/first-selector/

    You’ll notice that this is a jQuery extension and not part of the CSS specification.
    Also that :first is equivalent to :eq(0), that means if you want to get the second element, you can do it with :eq(1).

    If you don’t need a filter in the CSS selector, you can simply get the element with the .eq method like this:

    $('.tabs').eq(0) // get the first element
    $('.tabs').eq(1) // get the second element
    $('.tabs').eq(2) // get the third element
    $('.tabs').eq(-2) // get the second to last element
    $('.tabs').eq(-1) // get the last element
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a treeview that renders as tables. The html would be something like:
I have a div that has a bunch of child divs. I would like
I have a structure of div s inside div s, something like: <div> <div>
Hi stack overflow community. I have 2 dynamic divs that I want to float
I have view stack in a app like so: <mx:ViewStack id=viewStack left=0 right=0 top=0
I'm outside gdb's target executable and I don't even have a stack that corresponds
Is it possible to stack three DIVs vertically and have just the middle div
I have an rss widget in place that is generating these weird divs that
Is it possible to stack up multiple DIVs like: <div> <div></div> <div></div> <div></div> <div></div>
I am trying to build a Stack List using DIV's I have 3 divs

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.