문제

How do I wrap very long text in jGrowl?

Right now, if the text is long it just tosses out of the page.

Thanks.

도움이 되었습니까?

해결책

Well Hulk, since we haven't gotten any more info from you, I'm just going to take a stab at a solution.

This will break any long text after 15 characters. (Of course, you can substitute whatever number you want.)

This assumes there are no HTML tags. Just text.

var theText = $('.myContainer').text().split(' ')
jQuery.each(theText,function(i,val){
    theText[i] = val.replace(/^(\S{15})(\S+)/,'$1 $2')
})
$('.myContainer').text(theText.join(' '));
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top