$(".properCharater").each(function () {
var j = 0;
var properCharater = $(this).next("input").val();
if (properCharater != null) {
var properSplit = properCharater.split(",");
for (var i = 0; i < properSplit.length - 1; i++) {
if (properSplit[i] != null && properSplit[i] != '') {
j++;
$(this).append("<span>" + properSplit[i] + "</span>");
$(this).append(" ");
}
if (j == 3) {
break;
}
}
}
})
转载于:https://www.cnblogs.com/zhangyong0908/p/9409003.html