我需要在< p ="minimize"> < /p>
目前中添加<br />
的內容即使在字符串中<br />
,輸出中的所有字符串都顯示在1號線沒有任何<br />
。如何檢測<br>標籤目前不
下面的代碼似乎沒有檢測<br />
。
jQuery(function(){
var minimized_elements = $('p.minimize');
minimized_elements.each(function(){
var t = $(this).text();
if(t.length < 100) return;
$(this).html(
t.slice(0,100)+'<span>... </span><a href="#" class="more">More</a>'+
'<span style="display:none;">'+ t.slice(100,t.length)+' <a href="#" class="less">Less</a></span>'
);
});
$('a.more', minimized_elements).click(function(event){
event.preventDefault();
$(this).hide().prev().hide();
$(this).next().show();
});
$('a.less', minimized_elements).click(function(event){
event.preventDefault();
$(this).parent().hide().prev().show().prev().show();
});
});
非常感謝您的寶貴意見和時間
添加到您的html也讓我們可以檢查 –
Lorem存有悲坐阿梅德,consectetur adipiscing ELIT。 Vivamus eleifend risus sed feugiat faucibus。
Lorem ipsum dolor sit amet,consectetur adipiscing elit。 Vivamus eleifend risus sed feugiat faucibus。 < /p> – Roger
這樣的BR標籤心不是工作的所有字符串一起顯示 – Roger