我在按下键盘时打开模态时遇到问题,但是在单击时可以使用:
我创建一个“编辑”按钮:
var linkEdit = ' @Ajax.ActionLink("Edit", "ProjectTeamDynamic", new { formDutyHolderId = -1},
new AjaxOptions()
{
HttpMethod = "Post",
InsertionMode = InsertionMode.Replace,
UpdateTargetId = "EditModal",
OnComplete = "ShowPopup"
},
new
{
id = "updateDutyHolder",
@class ="form-control Edit",
title = "Edit Dutyholder"
})';
HTML:
<a class="form-control Edit" data-ajax="true" data-ajax-complete="ShowPopup" data-ajax-method="Post" data-ajax-mode="replace" data-ajax-update="#EditModal" href="/forms/ProjectTeamDynamic?formDutyHolderId=7911963" id="1" title="Edit Dutyholder">Edit</a>
我想在完成时打开一个Modal弹出窗口:
function ShowPopup() {
$("#ptdModal").modal();
};
我尝试了多种方法来实现这一目标,但是这是我使用标题的代码,但是甚至没有引起注意:
$(function () {
$("input[title='Edit Dutyholder']").on('keydown', function (e) {
alert('Test')
if (e.which == 32) {
$(this).trigger("click")
}
});
});