JSFiddle - React, Tailwind, and code Playground

by Nitin Singh Chouhan

HTML

<a class="respond-to-messages" id="1" href="#">Reply to message</a>

    <div id="comment-1" class="comment-respond-form post-id-<?php echo $comment->comment_post_ID; ?>">
        <table>
            <tr>
                <form id="custom_comments-form" action="" method="post">

                    //form fields

                    <button class="uk-button" type="submit">Send</button>
                </form>
            </tr>
        </table>
        </div> 
        <br>
 <a class="respond-to-messages" id="2" href="#">Reply to message</a>

    <div id="comment-2" class="comment-respond-form post-id-<?php echo $comment->comment_post_ID; ?>">
        <table>
            <tr>
                <form id="custom_comments-form" action="" method="post">

                    //form fields

                    <button class="uk-button" type="submit">Send</button>
                </form>
            </tr>
        </table>
        </div> 
        <br>
  <a class="respond-to-messages" id="3" href="#">Reply to message</a>

    <div id="comment-3" class="comment-respond-form post-id-<?php echo $comment->comment_post_ID; ?>">
        <table>
            <tr>
                <form id="custom_comments-form" action="" method="post">

                    //form fields

                    <button class="uk-button" type="submit">Send</button>
                </form>
            </tr>
        </table>
        </div> 
        <br>
  <a class="respond-to-messages" id="4" href="#">Reply to message</a>

    <div id="comment-4" class="comment-respond-form post-id-<?php echo $comment->comment_post_ID; ?>">
        <table>
            <tr>
                <form id="custom_comments-form" action="" method="post">

                    //form fields

                    <button class="uk-button" type="submit">Send</button>
                </form>
            </tr>
        </table>
        </div>

CSS

.comment-respond-form
{
  display:none;
}

JavaScript

jQuery('.respond-to-messages').click(function(){ 
 
   jQuery(".comment-respond-form").hide();
 
   var current_id = this.id;

  jQuery('#comment-'+current_id).slideDown();

});