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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:48:49+00:00 2026-06-12T03:48:49+00:00

Given the following dom structure I would like to transform an ordered list to

  • 0

Given the following dom structure I would like to transform an ordered list to an unordered list.

<div class="wrapper"> 
  <ol>
    <li><div>foo</div></li>
    <ol>
      <li><div>bar</div></li>
    </ol>
    <li><div>batz</div></li>
  </ol>
</div>

What is the best way to do this?

  • 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-12T03:48:51+00:00Added an answer on June 12, 2026 at 3:48 am

    ok i had to work from the inside to the outside, only replaceWith wasn’t working because it replaced only the outer tags and didn’t replace the inner ones, so i solved it this way:

    $($('.wrapper').find('ol').get().reverse()).each(function(){
      $(this).replaceWith($('<ul>'+$(this).html()+'</ul>'))
    })
    

    if someone has a better solution i would be glad to hear it.

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

Sidebar

Related Questions

I have a DOM structure below: <div class='box'> <section id=profile> <h1>testuser</h1> <div id=following> <a
I've following DOM structure <div> <span>/* comment action */</span> //float:left <span>/* like action */</span>
Consider the following HTML: <div class=foo id=obj> I should be changed red <div class=bar
Given the following code in Eclipse: import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; import org.eclipse.jdt.core.dom.CompilationUnit; public class
Given following array: var arr = [undefined, undefined, 2, 5, undefined, undefined]; I'd like
Given the following code: final class retVal { int photo_id; } Gson gson =
Given the following models: team.rb class Team < ActiveRecord::Base has_many :events, :dependent => :destroy
I was wondering what an efficient algorithm would be in the following scenario: Given
Given an HTML string, I would like to return a modified string with the
Consider the following code: (live example here ) $(function() { var wrapper = $(<div

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.