i have a couple of links i need to correct using some jquery. The links are formatted like this:
I want to split the href an get everything thats behind the last two slashes, while everything in front is being deleted.
My best shot was the following:
$('.tt-products-listhighlights a').each(function() {
$(this).attr("href", function(index, old) {
return old.replace("produkt/", "produkte/singleview/produkt/");
});
});
i will go with split but there may be a better way
$('.tt-products-listhighlights a').each(function() {
var ary= $(this).attr("href").split("/");
var lst=parseInt(ary.length)-2;
ary[lst];//this is the last text
});