<div class="commentfull">
<?php $comment=m ysqli_query($connect, "SELECT * FROM comment WHERE product = '$p'"); $user=m ysqli_query($connect, "SELECT * FROM user"); $datauser=m ysqli_fetch_assoc($user); while ($datacomment=m ysqli_fetch_assoc($comment)) { ?>
<div class="commentcontent">
<div class="commentfill">
<?php echo $datacomment[ 'comment']; ?>
</div>
<ul>
<li class="commenttime">
<p>
<?php echo $datacomment[ 'time']; ?>
</p>
</li>
<li class="commentreply"><span id="triggerreply">Reply</span></li>
</ul>
</div>
<div class="commentformreply">
<form method="POST" id="myform" action="<?php echo $base; ?>/config/addcomment.php">
<input type="hidden" name="p" value="<?php echo $p; ?>" />
<textarea class="commentarea" name="comment" placeholder="Your comment"></textarea><span class="commentclose">cancel</span>
</form>
</div>
<?php } ?>
的jQuery:jQuery的,而PHP顯示隱藏
$("#triggerreply").click(function() {
$(".commentformreply").slideDown("medium");
});
$(".commentclose").click(function() {
$(".commentformreply").slideUp("medium");
});
CSS:
.commentformreply {display:none; }
所以,當我點擊 '回覆' 的節目每commentformreply,我只是希望他們中的一個出現在我點擊的地方,如何做到這一點?
是否#triggerreply出現多次。? – Riddler
是的,它的每個顯示評論框都是 –
您需要考慮將表註釋的主鍵添加到Div ID。用於識別。僅僅爲此目的,KAD的解決方案就足夠了。 – Riddler