超出文本框设置宽度,用省略号代替展示
var numberArr1 = [];
// 超出长度隐藏
function hidden() {
for (let i = 1; i < 12; i++) {
$(".number_" + i).each(function () {
eval("numberArr"+i).push($(this).text());
if ($(this).text().length > 7) {
$(this).text($(this).text().substring(0, 7));
$(this).html($(this).html() + '...');
}
});
}
console.log(numberArr1)
}
js对象判空
function changeRes(obj) {
if (obj === "NaN" || obj === null || obj === undefined || obj === 'undefined') {
obj = "";
}
return obj;
}