当前位置:Gxlcms > JavaScript > jQuery 循环遍历改变a标签的href(实例讲解)

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

时间:2021-07-01 10:21:17 帮助过:5人阅读

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

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

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

人气教程排行