Zack
Zack

Reputation: 183

Character Count - Show more link

I am following this link link to dynamically add read more to text if it exceeds x no of characters. Working fine with below case.

<div class="comment more">weekly, monthly or quarterly analysi...</div>

not with this case

<div class="comment more"><p>weekly, monthly or quarterly analysi...</p></div>

by adding a p tag it stops working

Upvotes: 0

Views: 37

Answers (1)

eisbehr
eisbehr

Reputation: 12452

You have to select the p element in line 7+16 then, to get and set the correct content:

var content = $("p", this).html();
// ...
$("p", this).html(html);

Working example.

Upvotes: 1

Related Questions