Welcome Guest, Not a member yet? Register   Sign In
How to hide comments and only show when click on "show comments"
#1

[eluser]Volkof[/eluser]
Hi all,

I'm implementing something like facebook comment; where a person posts something and other people can comment. So in my case, someone wrote a review, and anyone can comment on it.

What i'm trying to figure out is how do you hide the comments, then only when you click on "show comments" will it display all the comments.

I don't want to use the facebook plugin, cause I don't want people's comment to be viewable in facebook itself.

Here is part of my code.
Under //Comments for each Reviews, it displays all comments. I want to hide the comments.

Code:
if($reviews){
    $index = 1;  //Set initial index of Comment Array
    foreach($reviews as $row){
     echo 'Written by <b>'.$row->firstname.'</b>';
     echo ' on '.$row->dateOfPost.'<br/>';
     echo 'Recommendation: '.$row->recommendation.'<br/><br/>';
     echo 'Is this review helpful?<br/>';
     echo '<a href="votereview/getVote/'.$row-&gt;reviewID.'/'.$row-&gt;userID.'/1">Yes</a>: '.$row->numHelpful.'<br/>';
     echo '<a href="votereview/getVote/'.$row-&gt;reviewID.'/'.$row-&gt;userID.'/0">No</a>: '.$row->numNotHelpful.'<br/><br/>';
     echo $row->review;
    

     //Comments for each Reviews
     foreach($comments[$index] as $key){
      echo '<br/><br/>Commented by: <b>'.$key->firstname.'</b><br/>';  
      echo $key->comment.'<br/>';      
     }

I read through this website, but it is a little different from what I want.
It hides content for each comments, while I want to hide all the comments

http://viralpatel.net/blogs/dynamically-...nk-jquery/
#2

[eluser]InsiteFX[/eluser]
Random Snippets of Code for Web Developers

This is what you are looking for:
How to hide, show, or toggle your div





Theme © iAndrew 2016 - Forum software by © MyBB