当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jQuery 循环遍历改变a标签的href(实例讲解)

jQuery 循环遍历改变a标签的href(实例讲解)

2017年12月12日  | 移动技术网IT编程  | 我要评论
把info类下面所有的a标签链接后天加"#article"。 jquery(document).ready(function($){   $('.info a'

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

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

以上这篇jquery 循环遍历改变a标签的href(实例讲解)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持移动技术网。

如您对本文有疑问或者有任何想说的,请 点击进行留言回复,万千网友为您解惑!

相关文章:

验证码:
移动技术网