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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:50:45+00:00 2026-05-25T17:50:45+00:00

So, I have an HTML string that looks just like this: <div> <div class=venue-tooltip>

  • 0

So, I have an HTML string that looks just like this:

<div>
<div class="venue-tooltip">
    Filling station
    <div>
        <a class="manage-venue-details" rel="venue-id-10" href="javascript:void(0);">Add filling station info</a>
    </div>
</div>
</div>

I want to get all the contents without the “a” element, so basically to have something like this:

<div>
<div class="venue-tooltip">
    Filling station
    <div>
    </div>
</div>
</div>

The HTML is loaded in a js string and I have tried those variants:

$(':not(a)', myHtmlString);
$(myHtmlString).not('a');

Both of them return unfiltered HTML. Any ideas?

My jQuery version is 1.6.1 and I test the above with Firefox 6

  • 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-25T17:50:45+00:00Added an answer on May 25, 2026 at 5:50 pm

    You cannot use DOM manipulation functions to change a string. Try using regular expresions:

    code.replace(/<a( |>).*?<\/a>/gi,"");
    

    It’s more efficient than convert string in DOM, manipulate and then convert it again in again in a string.

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

Sidebar

Related Questions

I have a ViewModel that looks like this: public class CreateReviewViewModel { public string
I have some HTML that looks like this: $(document).ready(function(){ $('#cumulative-returns').graph({ width: 400, height: 180,
I have a model that looks something like this: public class SampleModel { public
I have a dropdownlist that looks like this: @Html.DropDownListFor( x => x.Attribute.AttributeID, new SelectList(Model.Attributes,
I have a string that is HTML encoded: '''&lt;img class=&quot;size-medium wp-image-113&quot;\ style=&quot;margin-left: 15px;&quot; title=&quot;su1&quot;\
If I have a string that contains the html from a page I just
I have this piece of HTML: <div class=embed> <iframe width=300 height=200 frameborder=0 allowfullscreen= src=http://www.youtube.com/embed/123456></iframe>
Suppose I have a view model with a property that looks something like this:
lets say I have a class like this: public class MyClass { private String
Right now, my HTML code looks like so: <div id=register> <table class=tab2> <tr> <td>Email:</td>

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.