华佗小知识
您的当前位置:首页[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);
  });
});

显示全文