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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:13:18+00:00 2026-05-29T19:13:18+00:00

Have found a mixed bag of solutions that don’t seem to work. I’m loading

  • 0

Have found a mixed bag of solutions that don’t seem to work. I’m loading the HTML of a particular page, and want to extract the HTML from within an identified DIV – this works fine, but trying to remove an unidentified H3 tag from within the remaining HTML (and retain the following UL/LIs) seems to be impossible: I’ve tried everything Google has to offer, and can get either no results, or only the contents of the H3 tag. I’m trying to get the HTML of the UL list, including the UL tags.

/* variable html is the result of an AJAX load of the web page of interest*/
/* I know the first line below is not correct */
/* but it demonstrates the chain of events that I'm trying to accomplish*/

var theStuffIWant = $(html).find("#tab-2").remove("h3").html();

<div id="tab-2">
    <h3>Heading to get rid of</h3>
    <ul>The list I want to keep
         <li>List item to keep</li>
         <li>List item to keep</li>
         <li>List item to keep</li>
    </ul>
</div>
  • 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-29T19:13:19+00:00Added an answer on May 29, 2026 at 7:13 pm

    See http://jsfiddle.net/ewjBp/

    The remove() can’t be used in chaining, because it returns the elements that were removed.

    So you need to split: first remove the elements, then check the html() of the div, which was ridden of all h3.


    Edit

    http://jsfiddle.net/ewjBp/5/

    So, first you create a new Jquery object by wrapping the html you want (e.g. $(html)).

    As @pete stated, this won’t be inserted into DOM. DOM is the in-memory representation of the page, accessible to Javascript, meaning that $(html) won’t be added to the page structure representation.

    Then just find the headers (with children()), and replace with nothing.

    I suggest you read about replaceWith(), and the fact that it returns the old object instead. That’s why I discard return value. It’s not necessary, html will be changed anyway in the above code.

    Also, html.html() discards the outer HTML element in html, which is the DIV container in this example.

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

Sidebar

Related Questions

I have found myself designing a language for fun that is a cross between
I have found the way to copy the record that I would like, but
I have found that how to determine what columns are primary key column of
I have found that I often have to implement some sort of a scheduler
We have a .net 3.5 application (MVC and WebForms mixed) that was hosted on
The context I have a string made of mixed mp3 information that I must
I want to have mixed https/http site. Moreover I want have redirects from https
I have a mixed-mode application in which I want to fire up the debugger
I have found numerous examples on uploading a file to a web server via
I have found a Tutorial here on how to implement drag and drop in

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.