私はテーブルを持っています
<table id="favoriteFoodTable">
<th>
Food Name:
</th>
<th>
Restaurant Name:
</th>
<th>
</th>
<?php while ($row = $foods->fetch()) {
?>
<tr>
<td>
<?php echo $row['foodName']; ?>
</td>
<td>
<?php echo $row['restaurantName']; ?>
</td>
<td>
<a class="deleteLink" href="" >delete</a>
</td>
</tr>
<?php } ?>
</table>
私はこのjquery関数を使用しているので、ユーザーが削除をクリックすると、行の背景が変更され、行が削除されます
$(document).ready(function() {
$("#favoriteFoodTable .deleteLink").on("click",function() {
var td = $(this).parent();
var tr = td.parent();
//change the background color to red before removing
tr.css("background-color","#FF3700");
tr.fadeOut(400, function(){
tr.remove();
});
});
});
背景だけが変わっているのに行が削除されていないのはなぜですか?の解き方?