Reputation: 401
i have the following HTML:
<td class=" column-url"><a href="https://meine-homepage/wp/wp-content/uploads/2021/02/wohnung_nr_2.pdf"
target="_self">https://meine-hompage/wp/wp-content/uploads/2021/02/wohnung_nr_2.pdf</a></td>
Now i want to change the Link-Text in Text-String "PDF"
I Tryed the following jquery. But i got no results:
<script>
jQuery(document).ready(function( $ ) {
$(".column-url a").text("PDF");
});
</script>
Can somebody help me with this?
Upvotes: 1
Views: 69
Reputation: 68933
If you have the element td inside table then it should work. I also believe that you have space before the class name unintentionally in HTML:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
<tr>
<td class="column-url"><a href="https://meine-homepage/wp/wp-content/uploads/2021/02/wohnung_nr_2.pdf"
target="_self">https://meine-hompage/wp/wp-content/uploads/2021/02/wohnung_nr_2.pdf</a></td>
</tr>
</table>
<script>
jQuery(document).ready(function( $ ) {
$(".column-url a").text("PDF");
});
</script>
Upvotes: 1