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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:48:13+00:00 2026-05-11T17:48:13+00:00

i have the following html , and i want to hide all lsHeader which

  • 0

i have the following html , and i want to hide all lsHeader which has no next elements with class contact using jquery.

<div id="B" class="lsHeader">B</div>
  <div id="contact_1" class="contact"> B.Contact1</b/>
  <div id="contact_2" class="contact"> B.Contact2</b/>
  <div id="contact_3" class="contact"> B.Contact3</b/>
  <div id="contact_4" class="contact"> B.Contact4</b/>
  <div id="contact_5" class="contact"> B.Contact5</b/>
<div id="C" class="lsHeader">C</div>
  <div id="contact_6" class="contact"> C.Contact6</b/>
  <div id="contact_7" class="contact"> C.Contact7</b/>
  <div id="contact_8" class="contact"> C.Contact8</b/>
  <div id="contact_9" class="contact"> C.Contact9</b/>
  <div id="contact_10" class="contact"> C.Contact10</b/>
<div id="D" class="lsHeader">D</div>
<div id="F" class="lsHeader">F</div>

Note

lsHeader has no children, i want to check based on next elements.

  • 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-11T17:48:13+00:00Added an answer on May 11, 2026 at 5:48 pm

    What about this:

    $(".lsHeader").each(function() {
        if (!$(this).next().is("div.contact")) {
            $(this).hide();
        }
    });
    

    Depending on your specific needs, you may want to replace next with nextAll.

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

Sidebar

Related Questions

I have the following HTML code: <fieldset> <legend><span>Contact Details</span> <span class=edit1>Edit</span><span class=hide1>Hide</span></legend> <div> <!--content-->
I have the following html and I want to use jQuery to toggle the
I have the following html code: <div class=result hide id=userNameTooShort><span class=error>Your username needs to
I have the following HTML; <p class=postcontent> <img src=#> Some Text </p> I want
I have the following HTML: <span id=UnitCost5>$3,079.95 to $3,479.95</span> And i want to use
I have the following HTML: <input type=email id=email> I want to type text into
I have the following tag with a Html.TextBoxFor expression and I want the contents
I have following HTML <tr id=r1 class=l1> <td><img class=plusminus id=r1c1 src=assets/images/plus.png border=0 />3/10/12</td> <td></td>
I have the following HTML <label class=editable id=user_info_username>Hai world...</label> now on click function i
I have the following HTML: <div class=tvShow align=left> <div class=clearfix style=margin:0px 0px;> <h3 class=left

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.