user1928545
user1928545

Reputation:

jquery .dotdotdot is not working

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.

Upvotes: 3

Views: 5526

Answers (2)

Tim B James
Tim B James

Reputation: 20364

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

Upvotes: 1

dexterous
dexterous

Reputation: 111

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.

Upvotes: 3

Related Questions