Question

How do I wrap very long text in jGrowl?

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

Thanks.

Was it helpful?

Solution

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(' '));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top