내가 삭제에 대한 사용자의 클릭이 행의 배경이 변경되고 행이 다음 삭제됩니다 그래서이 JQuery와 기능을 사용JQuery와 삭제 테이블 행
<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>
테이블을 가지고
$(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();
});
});
});
배경이 변경되지만 행이 삭제되지 않는 이유는 무엇입니까? 해결하는 방법?
에서 선택하려는 경우 http://codepedia.info/2015/02/remove-table-row-tr 좋은 기사입니다 -in-jquery/동적으로 추가 된 tr에 대해서도 테이블을 제거하는 방법에 대한 정보 –