I have need to find and replace all link that match for example i am looking for
.domainname.com/Home and i want to replace it with .domainname.com/ i only want to remove part of link
$('a').each(function() {
var $this = $(this),
aHref = $this.attr('href'); //get the value of an attribute 'href'
$this.attr('href', aHref.replace('domainname.com/Home', 'domainname.com/')); //set the value of an attribute 'href'
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul class="rd-navbar-nav">
<li>
<a href="https://domainname.com/Home">
<span>Home</span>
</a>
</li>
<li>
<a href="https://domainname.com/about-us">
<span>About Us</span>
</a>
</li>
<li>
<a href="https://domainname.com/contact-us">
<span>Contact Us</span>
</a>
</li>
</ul>
.replace?.attr("href")?