首页 > Web开发 > 详细

[jQuery]循环遍历改变a标签的href

时间:2017-07-12 00:01:25      阅读:306      评论:0      收藏:0      [点我收藏+]

把info类下面所有的a标签链接后天加"#article"。

jQuery(document).ready(function($){
  $(‘.info a‘).each(function(){
    let Ahref = $(this).html() + "#article";
    $(this).attr("href",Ahref);
  });
});

[jQuery]循环遍历改变a标签的href

原文:http://www.cnblogs.com/SoYang/p/7152868.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!