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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:48:02+00:00 2026-06-18T08:48:02+00:00

I have a Div with contents <div id=dv> <ul><li><a class=html>abcd</a></li></ul> <ul><li><a class=bold>cdef</a></li></ul> <ul><li><a class=bold>xyz</a></li></ul>

  • 0

I have a Div with contents

<div id="dv">

<ul><li><a class="html">abcd</a></li></ul>

<ul><li><a class="bold">cdef</a></li></ul>

<ul><li><a class="bold">xyz</a></li></ul>

</div>

I want to display none second and 3rd ul dynamically. How can I do that ?

  • 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-18T08:48:03+00:00Added an answer on June 18, 2026 at 8:48 am

    You can find all the children of the div, hide them, then find the ul containing the li with class "html" and show that ul:

    $("#dv").children('ul').hide().find('li.html').closest('ul').show();
    

    Live Example | Source

    What that does:

    • $("#dv") – Finds the relevant div
    • .children('ul') – Finds its children that are ul elements
    • .hide() – Hides them
    • .find('a.html') – Finds any a elements withinin those uls that have class "html"
    • .closest('ul') – Gets the ul containing that a element
    • .show() – Shows it
    • 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 <div class=section> <div>header</div> <div> contents <div>sub contents 1</div> <div>sub
i have my html something like this... <div class = content> <div class =
I have this HTML code <div class=anc-style onclick=window.open('./view.php?a=foo')></div> I'd like to extract the contents
I have a simple div on html, something like: <div class=warning> <h3>Please make sure:</h3>
I have the following HTML: <div class=item> <img src=http://mintywhite.com/images/wg/0904/05rssfeedicons/rss-feed-icons11.jpg/> TEXT NODE <span class=some_class>What the
I have copied the html contents of a div to a variable in javascript.
I have the following problem. I have three images in my index.html: <div class
I have the following HTML. <div class=red>Div One</div> <div class=green>Div Two</div> <div class=blue>Div Three</div>
I have a page with 10 different div contents in it. Based on my
I have a div that's set to overflow: auto; . This contents of this

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.