I know this should be simple but I can’t make it work. I have some text inside an tag which I need to change. It’s rendered by my CMS so I can’t change it on the back end. Here is the html.
<a href="/OrderRetrievev2.aspx?CatalogueID=105038" class="cartSummaryLink">View Cart</a>
I need to change “View Cart” to “View Summary”. Here is what I was trying to use with my jQuery.
$'a.cartSummaryLink').text().replace("View Cart" , "View Summary");
It’s not working. Thanks in advance for any help our suggestions!
I’m not sure if it was just a copy-pase error, but you need to have an opening
(on your$()function. Otherwise you will get a syntax error. Then, there is no need to call.replace(),.text()is a both a getter and a setter, so you can just pass"View Summary"to.text(), and it will change the element’s text.Like so: