gpt4 book ai didi

jquery - 淡出和删除表行在我的 asp.net mvc 中不能一起工作

转载 作者:行者123 更新时间:2023-12-01 06:02:41 25 4
gpt4 key购买 nike

我有以下脚本来淡入淡出,然后删除表格行,但它只删除该行。

function deleteconfirmation() {
$(this).fadeOut('slow', function () { $(this).remove(); });
jAlert('The Answer was deleted succsfully', 'Deletion Confirmation');
}

那么在删除表格行之前是否可以淡出它?如果可以的话我该怎么做?

编辑:-这是将删除其行的表格:-

@foreach (var answer in Model.Answers.OrderBy(a=> a.IsRight))
{
<tr id = @answer.AnswersID>

<td>
@Html.DisplayFor(modelItem => answer.Description)
</td>
<td>
@Html.DisplayFor(modelItem => answer.Answer_Description.description)
</td>
<td>
@Ajax.ActionLink("Delete", "Delete", "Answer",
new { id = answer.AnswersID },
new AjaxOptions
{
//OnBegin = "deleteconfirmation1",
Confirm = "Are You sure You want to delete this Answer ?",
HttpMethod = "Post",
UpdateTargetId = @answer.AnswersID.ToString(),
OnSuccess = "deleteconfirmation",
OnFailure = "deletionerror"
})


</td>
</tr>
}

最佳答案

试试这个:

$( '.mySelector' ).click( function(){
var self = this;

/* look the next line */
$( self ).fadeOut('slow',function(){
$( this ).remove();
});

} );

第一:“$(this)”是一个对象?

尝试:

if( $(this).length > 0 )
{
alert( 'Yes!' );
}else{
alert( 'No!' );
}

如果不是对象,请定义您的对象:

var self = this;
//OR
var self = $( '.mtSelector' );

关于jquery - 淡出和删除表行在我的 asp.net mvc 中不能一起工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9643523/

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