Removing ' &raquo; ' from a String using jQuery
<p>I have a <code>&lt;div id="bread"&gt;&lt;/div&gt;</code> and I am trying to display breadcrumbs where one of the string contains <code>Tab3 »</code>.</p>

<p>Its like <code>Tab1</code> > <code>Tab2</code> > <code>Tab3 »</code> > <code>Tab4</code> except that <code>&gt;</code> is an <code>arrow-right.png</code> image.</p>

<p>I want to remove <code>&amp;raquo</code> or <code>»</code> from <code>Tab3 »</code>.</p>

<p>I want to search if the selected tab has <code>»</code> or <code>&amp;raquo</code> in it and if it does then I want to replace it with <code>""</code> so that <code>Tab3 »</code> becomes <code>Tab3</code>.</p>

<p>I've tried the following but it doesn't seem to work.</p>

<pre><code>$("document").ready(function() {
    var crumbs = $("a.selected");

    jQuery.each(crumbs, function() {

        if(this != crumbs.get([0])) {
            $("#bread").append("&amp;nbsp;");           
        }           
        $("#bread").append("&lt;img src='&lt;c:url value="/resources/images/arrow-right.png" /&gt;' /&gt;" + "&amp;nbsp;");

            var crumb = $(this).html();
            var slicedCrumb;
            if(crumb.indexOf(' &amp;raquo; ') != -1) {
                slicedCrumb = $(this).html().replace(' &amp;raquo; ', '');              
                $("#bread").append(slicedCrumb);
            }
            else {
                $("#bread").append(crumb);
            }

     });
}); 
</code></pre>

<p>I also tried to use <code>»</code> at the place of <code>&amp;raquo;</code> but that din't seem to work either.</p>

<pre><code>$("document").ready(function() {
    var crumbs = $("a.selected");

    jQuery.each(crumbs, function() {

        if(this != crumbs.get([0])) {
            $("#bread").append("&amp;nbsp;");           
        }           
        $("#bread").append("&lt;img src='&lt;c:url value="/resources/images/arrow-right.png" /&gt;' /&gt;" + "&amp;nbsp;");

            var crumb = $(this).html();
            var slicedCrumb;
            if(crumb.indexOf(' » ') != -1) {
                slicedCrumb = $(this).html().replace(' » ', '');                
                $("#bread").append(slicedCrumb);
            }
            else {
                $("#bread").append(crumb);
            }

     });
});
</code></pre>

<p>I've spent quite sometime reading other posts on the given subject but somehow I am not able to get it working. Could someone help me understand what am I missing here? I am using <code>jquery-1.5.js</code> to run this code. Do I need to use the newer version of <code>jquery</code> or any other library as well to get it working?</p>
