Support » Themes and Templates » Use jquery in a for statement to show/hide fields

  • Hello every one! i having a question and i want your help. i’m trying to use j query to hide some contents in a for statement but is not working. here is the code

    $total_attachments = count($attachments);
          if( $total_attachments > 0 )
            for ($i=0; $i < $total_attachments; $i++)
                //output div and image in it
                echo '<div class="pictures_entry_singles">';
                echo '<img src="'.$attachments[$i]["location"].'" width="128" height="120" alt="'.get_the_title().'" />';
                echo '<div id="title">';
                echo '<h6>'.$attachments[$i]["title"].'</h6></div>';
                echo '<div class="description">';
                echo '<h6>'.$attachments[$i]["description"].'</h6></div>';
                    echo '</div>';
          } }

    here is my java script code

    $(document).ready(function(){ // waiting for the document to be ready for manipulation
                            $(".description").hide(); // Hide the text at the loading of the page
                                $("#pictures_entry_singles img").click(function(){ // When the image is clicked do...
                                    $(".description").slideToggle(1000, "swing"); //... do a slide

    i want to hide the description. and when a user clicks on a picture <img src=”‘.$attachments[$i][“location”].'” width=”128″ height=”120″ alt=”‘.get_the_title().'” />, i want to slide down the description of this picture. how i can do this?

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Use jquery in a for statement to show/hide fields’ is closed to new replies.