给页面上所有的a标签增加随机数每次点击保证最新

$(document).click(function(){
$("a").each(function(){
if($(this).parent().parent().hasClass('list-unstyled')){
var href=$(this).attr("href");
var newHref=""
if(href.indexOf("&randomzzz=")>-1){
newHref=href.substring(0,href.indexOf("&randomzzz="));
$(this).attr("href",newHref+"&randomzzz="+Math.round(Math.random()*100000000000000));
}else{
$(this).attr("href",$(this).attr("href")+"&randomzzz="+Math.round(Math.random()*100000000000000));
}
}
})
})

原文地址:https://www.cnblogs.com/liuhao-web/p/9578400.html