$(function(){ //banner 拆字 $(".p_summary").each(function() { // 获取文本 let text = $(this).text(); // 去掉左右空白 text = text.trim(); // 将文本分离成数组 ["关", "于", "我", "们"] let text_array = text.split(""); // 将每个文本用span包裹 let html = text_array.join(""); // 加上头尾 html = "" + html + ""; // 替换文本 $(this).html(html); }); })