Reputation: 6768
I have got two links :
<li><a href="/newproducts" id="quiklinks_02">New products</a>
<a href="/c/13/latest-products"/>
I want to replace the href="/c/13/latest-products" with href="/newproducts" , how can i acheive this using replace with.
Regards
Upvotes: 0
Views: 62
Reputation: 165941
You don't need to use replaceWith
if you want to just change the href
. You can simply use attr
:
$("a[href='/c/13/latest-products']").attr("href", $("#quiklinks_02").attr("href"));
You may be able to improve the first selector as I get the impression the example in your question is not your full code!
Upvotes: 2