javascript - Display read more button after 200 characters -


i use code display text.

i want display read more button after 200 characters, display other text of div. , want display read less button, when text displayed.

how can achieve that?

code:

<div class="reviewtekst"> <p> text </p> </div> 

you need inspect first length of text if greater 200.

$('.reviewtekst').each(function() {     var $ptag = $(this).find('p');     if($ptag.text().length > 200){       ....    } } 

you need copy original text , take first 200 caracters, after append div. have 2 p tags, 1 preview other 1 full text. append links , bind click event on them show/hide full text. can take @ jsfiddle: https://jsfiddle.net/8cm67cun/


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -