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

  • Home
  • SEARCH
  • 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 7665115
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:28:44+00:00 2026-05-31T14:28:44+00:00

Possible Duplicate: Remove text with jQuery <div class=pun-crumbs><p class=crumbs> <a href=/>Forum</a> <strong> » <a

  • 0

Possible Duplicate:
Remove text with jQuery

<div class="pun-crumbs"><p class="crumbs">
<a href="/">Forum</a>
<strong>
 »
<a class="nav" href="/c4-our-mods">Test</a>
 » 
<a class="nav" href="/f7-forum">
<span>Test 1</span>
</a>
</strong>
</p>
</div>

How do I remove the second ‘»’ via jquery ? Thanks for answering my question 🙂 .
Note: I can’t edit the html.

  • 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-31T14:28:45+00:00Added an answer on May 31, 2026 at 2:28 pm

    jQuery doesn’t have much support for text nodes so if the text you’re looking for isn’t wrapped in it’s own element, then you can do it something like this:

    var cntr = 0;
    $(".pun-crumbs strong").contents().each(function() {
        // nodeType 3 is text nodes
        // nodeValue is the contents of a text node
        if (this.nodeType == 3 && this.nodeValue.indexOf("»") != -1) {
            ++cntr;
            if (cntr == 2) {
               this.parentNode.removeChild(this);
            }
        }
    });
    

    You can see it work here: http://jsfiddle.net/jfriend00/5AdNM/

    This is generally advantageous over code that modifies innerHTML because this code won’t mess with any event handlers that may already be applied whereas assigning a new, changed value to innerHTML will wipe out any event handlers (because it recreates new DOM objects).

    This version of the code removes the whole text node that contains the chevron because that looked to be the most convenient things for your particular HTML. If you wanted to leave other text in that text node, you could use .replace() to remove just the chevron from the text mode and leave the other text.

    This other version of the code would remove just the chevron, leaving other stuff in that text node:

    var cntr = 0;
    $(".pun-crumbs strong").contents().each(function() {
        // nodeType 3 is text nodes
        // nodeValue is the contents of a text node
        if (this.nodeType == 3 && this.nodeValue.indexOf("»") != -1) {
            ++cntr;
            if (cntr == 2) {
               this.nodeValue = this.nodeValue.replace("»", "");
            }
        }
    });​
    

    You can see this one work here: http://jsfiddle.net/jfriend00/XsnEW/

    If you control the HTML and can put the chevrons in their own span with a unique class name on them, then it’s a lot easier to do with plain jQuery.

    Here’s a bit simpler version that removes the chevron text node:

    $(".pun-crumbs strong").contents().filter(function() {
        return (this.nodeType == 3 && this.nodeValue.indexOf("»") != -1);
    }).eq(1).remove();
    

    or modifies it:

    var textNode = $(".pun-crumbs strong").contents().filter(function() {
        return (this.nodeType == 3 && this.nodeValue.indexOf("»") != -1);
    }).get(1);
    textNode.nodeValue = textNode.nodeValue.replace("»", "");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Php: remove all tags, but “a href” in a text Is there
Possible Duplicate: Remove CSS from a Div using JQuery we can set backgroung-image property
Possible Duplicate: How to remove border around text/input boxes? (Chrome) Is there a way
Possible Duplicate: How to remove the text in progressBar in Android? I have basic
Possible Duplicate: how remove wordwrap from textarea I have a text area : <textarea
Possible Duplicate: Remove non breaking space (&nbsp;) from between elements using jquery How to
Possible Duplicate: php regexp: remove all attributes from an html tag $input = '<div
Possible Duplicate: php multi-dimensional array remove duplicate I have an array like this: $a
Possible Duplicate: SQL Server Full text Index SQL Server stored procedure parameter output I
Possible Duplicate: Remove the date/time in my sql script generated using EM? Database -

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.