Jquery script to show/hide content with the_ID?

I have a HTML code:

<div class="content">
 blablabla
</div>

<a href="#" class="show">Show hidden content</a>

<a href="#" class="hide">Hide content</a>

I need Jquery code to show or hide div “content”, but i need that code to work with <?php the_ID (); ?> its will be used in posts loop so i need unicue ID’s.

Read More

Ex.: <div class="content-<?php the_ID (); ?>">

Any ideas?

Related posts

Leave a Reply

1 comment

  1. Try this:

    $('.show').click( function(){
        $('.content-<?php the_ID (); ?>').show();
    });
    
    $('.hide').click( function(){
        $('.content-<?php the_ID (); ?>').hide();
    });