views:

95

answers:

1

How do I wrap very long text in jGrowl?

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

Thanks.

+1  A: 

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(' '));
patrick dw