码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-07-12 01:24:13      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:改变   标签   attr   jquer   art   this   att   each   let   

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

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

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

标签:改变   标签   attr   jquer   art   this   att   each   let   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!