$(function() { var phone = $('#phone').text(); var mphone = phone.substr(0, 3) + '****' + phone.substr(7);
此时mphone 的值就是中间四位显示为*号的了; $('#phone').text(mphone) });
$(function() { var phone = $('#phone').text(); var mphone = phone.substr(0, 3) + '****' + phone.substr(7);
此时mphone 的值就是中间四位显示为*号的了; $('#phone').text(mphone) });
转载于:https://www.cnblogs.com/zhouwen2017/p/9046206.html