我正在寻找一个脚本来在多个单词之后放置一个换行符。我在stackoverflow中找到了这个:Applying a style to and insert a line break after the first word in a link
所以,我稍微改变一下:
var el = $('.wtt'); //where wtt is the class of the elements that you want to add the <br />
var text = obj.html();
var parts = text.split(' ');
//number 7 represents 8 words
$('.wtt').html($('.wtt').html().replace(parts[7],parts[7]+'<br />'));