$(".user-name").each(function(){
var userName = $(this).html().trim();
var _name = "";
var nameLength = userName.length;
if (nameLength > 2) {
var nameLength = nameLength - 2;
while (nameLength > 0) {
_name += "*";
nameLength--;
}
userName = userName.substr(0, 1) + _name + userName.substr(userName.length - 1, userName.length);
$(this).html(userName);
}
})
时间: 2024-11-13 10:10:44