I'm still learning and although my method works, I'm not convinced it's elegant and could be improved. Basically we have a system where I CAN'T control the output so I'm using the following code to get the href of an anchor and manipulate it to point to the correct place.
HTML
<a class="shop-return" href="/_shop/category/prodect/">Link</a>
jQuery
//set url object
var link = $(".shop-return");
//get url objects href value + split it into parts
var linkUrl = link.attr("href").split("/");
/*remove the starting blank space and the ending
product part of url*/
linkUrl.splice(-2,2)
linkUrl.shift();
//build new link
var newLinkUrl = linkUrl.join("/");
//set new link on object
link.attr('href', "/" + newLinkUrl + "/");
Any suggestions on how to make this cleaner / more efficient - and if I've gone about things in the right away or not would be appreciated.