Jquery for each link ...

Job ID: 36827311

Budget: $2 – $8 USD

Hello, I have a function, which on website load runs loop of all links starting with /, then it should append new href with starting domain, sadly it is working only few links. This is code:

$(document).ready(function(){
$('a[href^="/"]').each(function(){
var newUrlr = this.href;
$(this).attr("href", newUrlr);
});

});
Related categories: PHP JavaScript CSS HTML jQuery / Prototype