[jQuery]循环遍历改变a标签的href
来源:动视网
责编:小采
时间:2020-11-27 20:16:27
[jQuery]循环遍历改变a标签的href
[jQuery]循环遍历改变a标签的href:把info类下面所有的a标签链接后天加#article。 jQuery(document).ready(function($){ $('.info a').each(function(){ let Ahref = $(this).attr(href) + #article; $(this).attr(href,Ahref);
导读[jQuery]循环遍历改变a标签的href:把info类下面所有的a标签链接后天加#article。 jQuery(document).ready(function($){ $('.info a').each(function(){ let Ahref = $(this).attr(href) + #article; $(this).attr(href,Ahref);

把info类下面所有的a标签链接后天加"#article"。
jQuery(document).ready(function($){
$('.info a').each(function(){
let Ahref = $(this).attr("href") + "#article";
$(this).attr("href",Ahref);
});
});
[jQuery]循环遍历改变a标签的href
[jQuery]循环遍历改变a标签的href:把info类下面所有的a标签链接后天加#article。 jQuery(document).ready(function($){ $('.info a').each(function(){ let Ahref = $(this).attr(href) + #article; $(this).attr(href,Ahref);