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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:35:10+00:00 2026-05-30T20:35:10+00:00

This is my HTML: <ul class=test> <li><a href=#>One</a> <ul> <li>Content One</li> </ul> </li> <li><a

  • 0

This is my HTML:

  <ul class="test">
   <li><a href="#">One</a>
    <ul>
     <li>Content One</li>
    </ul>
   </li>
   <li><a href="#">Two</a>
    <ul>
     <li>Content Two</li>
    </ul>
   </li>
  </ul>

I want to hide UL.TEST LI UL. When I click anchor “one” or when I click “ul.test li” or “ul.test li a”

How will I do it without using a CLASS or ID in the “ul.test li ul”?

My code is:

  $(function(){
   $("ul.test li").click(function(e){
    e.preventDefault();
    $(this).slideToggle("fast");
   });
  });

What I want to do:

  $(this + "ul").slideToggle("fast");

I want to hide only ul.test li ul only.

what if?

$("ul.test li a").click(function(e){
  $('ul', this).slideToggle("fast");
});

how will I go back to ul.test li using $('ul', this).slideToggle("fast");

  • 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-30T20:35:11+00:00Added an answer on May 30, 2026 at 8:35 pm

    Try this:

    $("ul.test li").click(function(e){
      $('ul', this).slideToggle("fast");
    });
    

    Demo: http://jsfiddle.net/9KAhT/

    $("ul.test li a").click(function(e){
       $(this).next().slideToggle("fast");
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using XPath to parse this link $html = '<a href=/browse/product.do?cid=1&amp;vid=1&amp;pid=1 class=productItemName>what is going on
Suppose I have the following html: This a test of <code>some code</code>. <div class='highlight'>
I have html like: <fieldset> <div> <ul> <li class=test> This paragraph contains a very
i have my html something like this... <div class = content> <div class =
i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul>
I have the html below: <span class=srch-URL> <a id=CSR_U_2 href=http://www.test.com/TestForm.aspx>http://www.test.com/TestForm.aspx</a> </span> I am trying
Consider the following code: <html> <head></head> <body> <div id='test' class='blah'> <a href='http://somesite.com/' id='someLink'>click!</a> </div>
First my code: Html <div class="product_image m2" id="m2"><a href="#" id="10" class='multi2'>test..</a></div> JS $(document).ready(function(){ $("#m2
I have a sample code: <a title=click href=test.swf class=game-in-link style=background:#000;width:100%;height:450px;display:block;>CLICK ON PLAY</a> <div> <!--
I have got this html on the page: <a href=review.asp?sitename=webcamking#video_embed class=tutorials data_site=webcamking>&nbsp;&nbsp;Tutorial 1</a> 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.