I'm looking for a way to replace 18 links using jQuery.
What I have is this:
<a class="PDF-link" href="http://domain/0101_xxx.pdf" target="_blank">folder 1</a>
<a class="PDF-link" href="http://domain/0102_xxx.pdf" target="_blank">folder 2</a>
<a class="PDF-link" href="http://domain/0201_xxx.pdf" target="_blank">folder 2</a>
<a class="PDF-link" href="http://domain/0202_xxx.pdf" target="_blank">folder 2</a>
14 more like this
and I started with this jQuery:
$(document).ready(function() {
var client = "<%=UserController.GetCurrentUserInfo().Username%>";
$('.PDF-link').prop('href', $('.PDF-link').prop('href').replace('xxx', client));
});
But that generates the same URL for each link:
http://domain/0101_johndoe.pdf
http://domain/0101_johndoe.pdf
http://domain/0101_johndoe.pdf
http://domain/0101_johndoe.pdf
and I'd like it to be like this:
http://domain/0101_johndoe.pdf
http://domain/0102_johndoe.pdf
http://domain/0201_johndoe.pdf
http://domain/0202_johndoe.pdf
Can someone help me out?