Jquery 从多树结构的多元素选择器遍历特定树

Jquery 从多树结构的多元素选择器遍历特定树,jquery,Jquery,有人能帮我处理这个代码吗。 除了这段代码不起作用之外,一切正常 $(document).ready( function() { $("a.delete").click( function () { var cnf = confirm("Are you sure you want to delete this ticke

有人能帮我处理这个代码吗。
除了这段代码不起作用之外,一切正常

    $(document).ready(      
        function()
        {
            $("a.delete").click(
                function ()
                {
                    var cnf = confirm("Are you sure you want to delete this ticket?");
                    if(cnf){
                        $.post($(this).attr('href'), 
                            { "ajx": true },
                            function(data){
                                    if(data.scs){
                                        /*this piece of code is not working*/
                                        $(this).closest('tr').remove();
                                        /*this piece of code is not working*/
                                        //alert("ticket was deleted");
                                    }
                                    else{
                                        alert("Error:: Ticket could not be deleted."+data.msg);
                                    }
                             }, "json");

                            //alert('the requested ticket was deleted.');
                    }
                    //alert();
                    return false;
                }                   
            );
        }
    );
我有一个表,我想删除包含已单击链接的行

表行如下所示

<?php while($row = mysql_fetch_assoc($result)): ?>
<tr>
 <td><?php echo ++$count; ?></td>
 <td><?php echo $row['name']; ?></td>
 <td><?php echo $row['eventname']; ?></td>
 <td>
  <div class="img">
  <img class='event' src="../upload/<?php echo $row['image']; ?>" alt="<?php echo $row['image']; ?>"/>
  </div>
 </td>
 <td><?php echo $row['status']; ?></td>
 <td><?php echo $row['date']; ?></td>
 <td><a href="addticket.php?action=edit&tid=<?php echo $row['id']; ?>">edit</a></td>
 <td><a class="delete" href="deleteticket.php?tid=<?php echo $row['id']; ?>" href="#">delete</a></td>     
</tr>    
<?php endwhile; ?>

下面的操作应该有效-在下一个“tr”中向上移动dom并将其删除

$('a.delete').click(function() {
  $(this).closest('tr').remove();
});

你的意思是我的代码正在工作。我收到了错误消息。。错误msg在代码工作的上方,但“this”可能不再是的实例
$('a.delete').click(function() {
  $(this).closest('tr').remove();
});
$("table").delegate("a.delete", "click", function(ev) {
  if(confirm("Are you sure you wish to delete this row?"))
    $(this).closest("tr").remove();
  ev.preventDefault();
});