用jquery中的link href值替换链接文本

用jquery中的link href值替换链接文本,jquery,html,Jquery,Html,我想用link href值替换链接的文本 我在表中有1000个这样的链接 html 请建议这样做的方法 谢谢。此处此不是指锚定。循环遍历每个锚节点并设置其文本。请尝试使用此代码 $('.link2 a').each(function(){ $(this).text($(this).attr('href')); }); 此处此不是指锚点。循环遍历每个锚节点并设置其文本。请尝试使用此代码 $('.link2 a').each(function(){ $(this).text($(

我想用link href值替换链接的文本

我在表中有1000个这样的链接

html

请建议这样做的方法


谢谢。

此处
不是指锚定。循环遍历每个锚节点并设置其文本。请尝试使用此代码

 $('.link2 a').each(function(){
   $(this).text($(this).attr('href'));
 });

此处
不是指锚点。循环遍历每个锚节点并设置其文本。请尝试使用此代码

 $('.link2 a').each(function(){
   $(this).text($(this).attr('href'));
 });

试试这个:您需要迭代每个锚定标记,因为您需要读取每个锚定标记
href
值并将其设置为文本

$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});

试试这个:您需要迭代每个锚定标记,因为您需要读取每个锚定标记
href
值并将其设置为文本

$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});
用这个

$('.link2 a').each(function(){
  $(this).html($(this).attr('href'));
});
用这个

$('.link2 a').each(function(){
  $(this).html($(this).attr('href'));
});

使用html()的回调函数,即或

$('.link2 a').html(function(){
   return this.href;
});

使用html()的回调函数,即或

$('.link2 a').html(function(){
   return this.href;
});
试试这个:

$('.link2').each(
 function(index)
 {
   $(this).children(":first").text($(this).attr('href'));
 }


);
$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});
试试这个:

$('.link2').each(
 function(index)
 {
   $(this).children(":first").text($(this).attr('href'));
 }


);
$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});
试试这个:

$('.link2').each(
 function(index)
 {
   $(this).children(":first").text($(this).attr('href'));
 }


);
$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});
试试这个:

$('.link2').each(
 function(index)
 {
   $(this).children(":first").text($(this).attr('href'));
 }


);
$('.link2 a').each(function(){
  $(this).text($(this).attr('href'));
});
易于使用下面的代码

    $('.link2 a').each(function(){
   $(this).text($(this).attr('href'));
 });
易于使用下面的代码

    $('.link2 a').each(function(){
   $(this).text($(this).attr('href'));
 });