[英]Change Link Text in HTML
i have the following HTML:我有以下 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"现在我想更改文本字符串“PDF”中的链接文本
I Tryed the following jquery.我尝试了以下 jquery。 But i got no results:
但我没有得到任何结果:
<script>
jQuery(document).ready(function( $ ) {
$(".column-url a").text("PDF");
});
</script>
Can somebody help me with this?有人可以帮我吗?
If you have the element td inside table then it should work.如果你在table 中有元素td那么它应该可以工作。 I also believe that you have space before the class name unintentionally in HTML:
我也相信您在 HTML 中无意间在class名称之前有空格:
<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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.