I have an automatically generated link from a cms that outputs
<a href="85858585858_file_name.pdf">85858585858_file_name.pdf</a>
I need to rename the link to something like "File name", instead of the one that it generates. I have a field that I can populate which I can use to replace the text. I have been able to do this with Jquery, but the problem is that I have many paragraphs (all of the same class) that each contain this link. The script changes the text, but it takes the first instance of my replacement value, and applies that to every paragraph. I cannot get it to work on each instance.

What I need is to have the script that will take each instance of the link, and replace the text with the text locate in the span directly previous to it.

I attempted to use (this) but I had no luck as I am not aware of how to traverse the DOM effectively. I would be okay to add the javascript directly in the output (as shown below). I think I'm making it more complicated than it needs to be.

The html at this point looks like this...

{tag_file_type} is where I am adding from a dropdown a class of pdf, txt, etc.
{tag_name} is the name I want to use as the files name
{tag file} is the CMS generated link that names the

HTML Code:
<p class="literature-container">
	<span class="{tag_file_type}"></span>
	<span class="tag_name">{tag_name}</span>
	<span class="tag_file">{tag_file}</span>
Any help would be greatly appreciated.