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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:32:14+00:00 2026-05-31T18:32:14+00:00

I want to remove only those ul with li that doesn’t have a custom

  • 0

I want to remove only those ul with li that doesn’t have a custom attribute on it. I was trying this

$myParent.children('li ul:not("ul[isClicked=True]")').remove();

but can’t get it to work. Any help would be appreciated.

  • 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-31T18:32:15+00:00Added an answer on May 31, 2026 at 6:32 pm

    If I understand you correctly, you want to remove the uls that contain lis with the attribute isClicked = "True":

    $myParent.find("li[isClicked=True]").parent("ul").remove();
    

    Note that the attribute must contain the word "True"; it’s a string, not a boolean.

    Live example

    From your comment below:

    I am looking for vice-versa actually. Remove all ul’s that don’t have the custom attribute.

    That’s the opposite of the opening sentence of your question (“I want to remove only those ul with li that have a custom attribute on it”). 🙂 Here’s how you’d do that assuming the ul elements are direct children of $myParent (your example code suggests this); if that’s not true, just change the .children on the first line to .find:

    $myParent.children("ul").each(function() {
      var $ul = $(this);
      if (!$ul.find("li[isClicked=True]")[0]) {
        // Doesn't have one, remove it
        $ul.remove();
      }
    });
    

    Live example


    FWIW, that attribute name won’t validate. You might consider switching to the data-* attribute form.

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

Sidebar

Related Questions

I have this problem that i want to transfer specific ( yet not that
I have a string which contains only numbers. Now I want to remove all
I want to remove all null properties in a generic object. It doesn't have
I have 2 cucumber scenarios that simulate paperclip image upload. I want to remove
I have a string that looks like - /celebrity.html#portfolios/jennifer-aniston-2006#img10 I want to remove #img10
I want to remove the option Invite Only from Membership Requests in Organic Groups.
I want to keep only numbers and remove all characters from a variable. For
I have a link_to_remote and I want to make sure people can only click
I want remove "Language" querystring from my url. How can I do this? (using
I want to remove digits from a float to have a fixed number of

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.