I want to show only e.g. 200 words from post with show/hide button to show whole post and hide post to 200 words. Text is on variable I don't know how to do this. I tried with javascript but I can't hide content of post.
here's the:
<div id="test">content</div>
<script>
var str = "<?=$row[3]?>";
var test = str.substr(0, 700);
document.getElementById('test').innerHTML = test;
</script>
<p id="demo"></p>
<script>
function myFunction() {
var str = "<?=$row[3]?>";
var test = str.substr(700);
document.getElementById("demo").innerHTML = test;
}
</script>
<button onclick="myFunction()">Click me</button>