Von diesem Code schrieb ich in Select-Abfrage wird es gut funktionieren, in der Datenbank habe ich 10 Zeilen so kommen 10 Kommentare, für mein Problem ist, habe ich eine Antwort-Taste während klicken der Antwortknopf, den ich ID erhalten möchte, von hier erhielt ich nur erste Reihenidentifikation, ich klicke allen Knopf, den ich id = 1 bekam, ich ding rel Attribut es Problem bildet, aber ich weiß exatly y nicht? es funktioniert nichtrel attributte funktioniert nicht in diesem Code
<?php
$comment = mysql_query("SELECT * FROM task_comments WHERE task_id='$task_id'");
while($com=mysql_fetch_assoc($comment)){
?>
<div class="comment">
<div class="img-thumbnail">
<img class="avatar" alt="" src="../TV/dist/img/user2-160x160.jpg">
</div>
<div class="comment-block">
<div class="comment-arrow"></div>
<span class="comment-by">
<strong><?php echo $com['comment_by'];?></strong>
<span class="pull-right">
<a href="#" rel="<?php echo $com['id']?>" class="reply-btn"><i class="fa fa-reply"></i> Reply</a>
</span>
</span>
<p><?php echo $com['comment'];?></p>
<span class="date pull-right"><?php echo $com['comment_on'];?></span>
</div>
</div>
<?php } ?>
<!-- My JS code Like this -->
$(document).ready(function(){
$('.reply-btn').click(function(event){
event.preventDefault();
alert($(".reply-btn").attr("rel"));// here i got only first row id name like 1
});
});
In diesem Code, was Sie geändert werden, weiß ich nicht, was ur – yuvi
'$ erzählt ("this")' sollte keine Anführungszeichen enthalten. '$ (this)' ist was du suchst. – Marcus
Ya, ich habe es, jetzt, Danke @ Marcus – yuvi