var strs = new Array(); //定义一数组 strs = appointment.split(","); //字号分割 for(i = 0; i < strs.length; i++) { var spans = ‘‘; spans += ‘<p style="font-size: 15px; class="child">‘ + strs[i] + ‘</p>‘; console.log(strs[i]); //分割后的字符输出 $(‘#appointment‘).append(spans); }
原文:http://www.cnblogs.com/hjptopshow/p/7747260.html