salmankhan2482's avatar

how to add "read more" or "read less" to a paragraph

i am using a ck editor for inserting content into the database which stores the data along with the html tags like

and i want to add read more or read less button to toggle the paragraph of around 200 characters.

<div class="panel" id="mongo">
		{!! nl2br(strip_tags($property->description)) !!}
</div>

i tried this solution https://laracasts.com/discuss/channels/laravel/read-more-in-paragraph but it actually disturbed the format of the paragraph and rendered the whole paragraph without the html tags like

0 likes
9 replies
vincent15000's avatar

I'm not sure to really understand what you are trying to do.

How do you want to display the whole paragraph ? On the same window ?

salmankhan2482's avatar

@Sinnbeck but actually the thing is that using that method disturb the pattern of the html. it makes the whole paragraph linear and all of the new line, break line and other html tags are removed.

salmankhan2482's avatar
salmankhan2482
OP
Best Answer
Level 1

@Sinnbeck thank you so much for your response. but i solved the problem by using the css by giving the height and overflow and then add two buttons read more which increase the height of the div and read less which reduces the height of the div.

Please or to participate in this conversation.