当前位置: 首页 > 工具软件 > jQuery A+ > 使用案例 >

jQuery遍历li下的a标签,添加参数

范凡
2023-12-01
$('.storeUrl a').each(function(){
     var Ahref =  $(this).attr('href');
     Ahref = Ahref + "?longitude="+longitude + "&latitude=" + latitude;
   $(this).attr("href",Ahref);
});

li标签添加class="storeUrl",用each遍历li标签下的a;

定义Ahref为获取到的a标签href地址;

给href添加经纬度参数;

把Ahref赋值给a标签的href。

 类似资料: