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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:15:13+00:00 2026-06-15T06:15:13+00:00

I am new on jQuery. I want to remove HTML tag only, not its

  • 0

I am new on jQuery. I want to remove HTML tag only, not its content. The following is my code

HTML

<ul>
  <li>
    <a href="#">Personal Loans</a>
    <ul>
      <li><a href="#">Secured Loans</a></li>
      <li><a href="#">Unsecured Loans</a></li>
      <li><a href="#">Bad Credit Loans</a></li>
    </ul>
  </li>
  <li>
    <a href="#">Debt Management</a>
    <ul>
      <li><a href="#">Debt Consolidation Loans</a></li>
      <li><a href="#">Credit Card Debt Management</a></li>
      <li><a href="#">IVAs</a></li>
    </ul>
  </li>
  <li>
    <a href="#">Payday Loans</a>
    <ul>
      <li><a href="#">Text Loans</a></li>
      <li><a href="#">Short Term Loans</a></li>
      <li><a href="#">Cash Loan</a></li>
      <li><a href="#">Same Day Loan</a></li>
      <li><a href="#">Instant Loans</a></li>
      <li><a href="#">Quick Loan</a></li>
      <li><a href="#">Cash Advances</a></li>
      <li><a href="#">Fast Loan</a></li>
    </ul>
  </li>
  <li><a href="#">Car Loan</a></li>
  <li><a href="#">Mortgage</a></li>
</ul>

I want to remove the nested <ul> only, but not its children <li>. Is this possible in jQuery? Please help me.

  • 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-15T06:15:14+00:00Added an answer on June 15, 2026 at 6:15 am

    You can’t put an li inside another li. What you can do, though, is move the li elements from within the ul and put them just after the li that used to contain the ul. Something along these lines:

    $("ul > li ul").each(function() {
        var $ul = $(this);
        $ul.children().insertAfter($ul.parent());
        $ul.remove();
    });
    

    Live Example | Source

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

Sidebar

Related Questions

I want load html code with jQuery and delete from this code some classes,
I'm new to jQuery and I want to have a input box from a
I'm new to JQuery and really struggling how to perform the query I want.
I am new to jQuery, so I'm having trouble solving this. I want this
I am new to jquery mobile. I have one problem. I want to increase
I want a simple effect of slide up and down. I'm new to jquery
Hi. I am new to jQuery.. I want to know how to call custom
i want to know how work facebook new timeline image reposition with jquery? this
I am familier with jQuery,Ajax and JSP Servlets but new to Struts2.I want to
Using jQuery UI 1.8rc3 combined with the new jquery.effects.fade.js code, I've been able to

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.