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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T23:25:19+00:00 2026-05-19T23:25:19+00:00

Is there a way in jQuery to return the nearest sibling() div and check

  • 0

Is there a way in jQuery to return the nearest sibling() div and check for a present class?

I have a visual verticle list of items, in which some items either have a 1px border (to set them apart – premium items) or no border at all (standard items). While it looks great when a premium item is sandwiched between two standard items, when two or three premium items stack up the borders between them end up being 2px thick.

I’m looking for a way, using jQuery or otherwise, to check if the <div class="item"> above the current div has the class featured-item (so checking if the div equals <div class="item featured-item">). From there, I will set another class name to set border-top to 0px and make the visuals flow a little better.

Can anyone help me out? Sorry if this question is convoluted, hard to explain!

  • 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-19T23:25:19+00:00Added an answer on May 19, 2026 at 11:25 pm
    if ($("#current-div").prev().hasClass("someClass")) {
      // logic here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to use JQuery to cloak or encrypt email addresses on
Is there any syntactical way in jQuery to define multiple CSS attributes without stringing
Using jQuery, is there a way to select all tag that reference a specific
I know you can do it for jQuery using jQuery.noConflict. Is there a way
Is there a better, more jQuery-ish way of handling this image substitution? var image
I'm working with jQuery and looking to see if there is an easy way
Is there any way to check whether a file is locked without using a
Is there way in next piece of code to only get the first record?
is there way thats i can preselect an item when the page loads or
Is there a way to enforce constraint checking in MSSQL only when inserting new

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.