gpt4 book ai didi

jquery - 如何使用淡出效果更改表格行的背景颜色?

转载 作者:太空宇宙 更新时间:2023-11-04 05:03:19 24 4
gpt4 key购买 nike

从表格中删除行时,我想更改行的背景颜色(红色)。

到目前为止,这是我的代码:

$('.delete').click(function(){
$id=$(this).attr('id');
$row = $(this).parents('tr:first');
$.ajax({
url:'admin/delete_post',
dataType:'json',
type:'POST',
data:'id=' + $id,
error:function(){
alert('There was an error');
},
success:function(data){
$row.fadeOut(600,function(){
$(this).remove();
});
}

})
});

编辑:包含标记。

<tr>
<td>abc</td>
<td>
<div class="controls ">
<textarea class="input-xlarge span10" name="content" id="textarea" rows="5"
cols="45">text</textarea>
</div></td>
<td>
<a class="btn delete" id="58"><i class="icon-trash"></i> Delete</a>
<a class="btn save" ><i class="icon-ok"></i> Save</a>
</td>
</tr>

最佳答案

success:function(data){
$row.find('td').css('backgroundColor', 'red').end().fadeOut(600,function(){
...
});
}

关于jquery - 如何使用淡出效果更改表格行的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11031190/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com