jquery - How do I delete a table row? -


i tried make following code work last 5-6 hours, had no luck.

can please me understand what's wrong code? after clicking on delete link nothing happens.

here table:

<table id="links">     <tr id="record-<?php echo $row['feepaymentid']; ?>">         <td><?php echo $row['masterentryvalue']; ?></td>         <td><?php echo $row['amount']; ?></td>         <td><a href="#" class="delete">delete</a></td>     </tr> </table> 

here javascript:

$('table#links td a.delete').click(function() {     if (confirm("are sure want delete row?")) {         var id = $(this).parent().parent().attr('id');         var data = 'id=' + id ;         var parent = $(this).parent().parent();          $.ajax({             type: "post",             url: "deleterow.php",             data: data,             cache: false,             success: function() {                 parent.fadeout('slow', function() {$(this).remove();});             }         });                     } }) 

the selector isn't correct, try this: $('#links a.delete') select anchor elements class 'delete' under element id 'links'

jsfiddle


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -