Php 使用span隐藏和显示内容

Php 使用span隐藏和显示内容,php,jquery,ajax,Php,Jquery,Ajax,我对php和jquery都是新手。我想使用span来隐藏和显示html和php中的内容。我可以使用jquery吗?如果是,我该怎么办?我已经将jquery脚本放在了页面的底部。这是我的代码: <!-- reply --> <span title="fas fa-reply" name="reply" data-id="1" </span> <!-- if span clicked show all these data...

我对php和jquery都是新手。我想使用span来隐藏和显示html和php中的内容。我可以使用jquery吗?如果是,我该怎么办?我已经将jquery脚本放在了页面的底部。这是我的代码:

    <!-- reply -->
    <span title="fas fa-reply" name="reply" data-id="1" 
    </span>
    <!-- if span clicked show all these data... -->
    <table class="table table-borderless" style="margin-top:50px;">
        <thead class="bg-secondary pb-0">
        <tr>
            <th colspan="3" class="pb-0">
            <p class="test text-light">Creating Reply <?php echo $rowAllPost["id"]; ?>
            </p></th>
            <th class="pb-0 text-right">
            </th>
            </tr>
        </thead>
            <th scope="row" style="width:15rem!important;">
            <img src="<?php echo $rowViewUserNow["picture"];?>" class="rounded-circle" style=height:93px;width:81px;><br>
            <p class="ml-3"> Online</p>
            <p class="ml-2"> <?php echo $rowViewUserNow["username"];?>
            </p>
            <i class="fas fa-info-circle pr-2 pt-2"></i>Active
            <td colspan="3" class="text-justify">
            <form action="controller/doCheckPost.php" method="post">
                <textarea name="description" class="form-control"></textarea>
            </td>
        </tr>
        <tr class="bg-secondary pb-0" >
            <th colspan="3" class="pb-0">
            <button title="Cancel" class="btn" type="submit" name="cancel"><i class="fas fa-times"></i></th></button>
            <th class= "pb-0 text-right">
            <button title="Submit" class="btn" name="submit"><i class="fas fa-check"></i></button>
            </form>
            </th>
            </th>
        </tr>
            </div>
        </tbody>
    </table>


最好的方法是首先为span和table元素都提供一个id。然后,您可以在jQuery中使用如下命令:

$('#spanId').on('click', function() {
  $('#tableId').toggle();
});
将显示隐藏的元素,并隐藏可见的元素

这将有助于: