例えば:
<p class="Pa0" style="margin: 0in 0in 0pt;"><span class="A1"><span style="font-size: 10pt;">Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers Giving this flyer to your class customers</span></span></p>Giving this flyer to your class customers Giving this flyer to your class customers
正規表現:
<[^<>]+>[^<>.!?]{250}
htmlタグを無視して、最初の250文字すべてを選択する必要があります。最初のhtmlタグの出現を無視しますが、2番目を選択します
コントロールがユーザーコントロールページにあったので、findを使用しています。それ以外のクラス名で十分です
$("#id").find(".class").each(function (i) {
var len = $(this).text().length;
if (len > 250) {
$(this).text($(this).text().substr(0, 250) + '...');
}
});
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加