Reputation: 684
I'm tring to change breadcrumbs arrow > (>
) to » using jquery.
<div id="breadcrumbs">
<a title="Go to cbc." href="http://cbcsales.co.il/newsite" class="home">Home</a>
> testpage</div>
I tried using following jquery. But tag is missing. It is replace <a>
tag >
character. Help me. Thanks
jQuery("#breadcrumbs").text(function(index, text) {
return text.replace('>', '»');
});
Upvotes: 3
Views: 4684
Reputation: 64
Use .html() at .text() like this
jQuery("#breadcrumbs").html(jQuery("#breadcrumbs").html().replace(">", "»"));
Upvotes: 2
Reputation: 128791
Just call replace
on the element itself, not within a function:
jQuery("#breadcrumbs").html(
jQuery("#breadcrumbs").html().replace('>', '»')
);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="breadcrumbs">
<a title="Go to cbc." href="http://cbcsales.co.il/newsite" class="home">Home</a>
> testpage
</div>
Upvotes: 4
Reputation: 162
Try to change the #breadcrumbs
attribute inside the Jquery with the .home
.
You will see that the link is still there.
Upvotes: 0