3

I've been trying to use jquery's dotdotdot method in order to cut off overflowed text, but for some reason it's not working. I was hoping the method would be pretty simple, but I don't know what I'm doing wrong.

Javascript:

$(document).ready(function(){ 
    $('.dotdotdot').dotdotdot({ 
        ellipsis: '... ', 
        wrap: 'word', 
        after: null, 
        watch: true, 
        height: 40 
    }); 
});

html:

<div class="dotdotdot">
    <?php echo $description; /*Current div height with text exceeds 40px*/ ?>
</div>

I cant find anything that would explain why this isn't working. My jquery is up to date, version 1.8.3.

Thomas Dignan
  • 7,052
  • 3
  • 40
  • 48

2 Answers2

3

dotdotdot is a jQuery plugin which you need to download separately and include that JS also then it should work. Refer to http://dotdotdot.frebsite.nl/ for more details.

dexterous
  • 111
  • 6
1

Depending on your needs, you could just use the text overflow property ellipses

See this website for more details, and an example.

http://www.quirksmode.org/css/user-interface/textoverflow.html

Tim B James
  • 20,084
  • 4
  • 73
  • 103
  • 1
    i do use the css version, the only problem is it only works for text that is on one line, not paragraphs –  Apr 29 '13 at 17:26