Jquery 模式确认按钮不存在´;行不通
我有一个引导模式确认对话框,有两个按钮:继续和取消,取消操作很好(只需关闭模式窗口),但继续不起作用,这是触发模式窗口的按钮代码:Jquery 模式确认按钮不存在´;行不通,jquery,asp.net-mvc,twitter-bootstrap,bootstrap-modal,Jquery,Asp.net Mvc,Twitter Bootstrap,Bootstrap Modal,我有一个引导模式确认对话框,有两个按钮:继续和取消,取消操作很好(只需关闭模式窗口),但继续不起作用,这是触发模式窗口的按钮代码: <button type="button" class="btn btn-danger" id="btn-cancelar" data-target="#basic" data-toggle="modal"> Cancelar <span class="glyphicon glyphicon-remove-sign"></span>
<button type="button" class="btn btn-danger" id="btn-cancelar" data-target="#basic" data-toggle="modal">
Cancelar
<span class="glyphicon glyphicon-remove-sign"></span>
</button>
<div class="modal fade" id="basic" tabindex="-1" role="basic" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
<h4 class="modal-title">book Delete Confirmation</h4>
</div>
<div class="modal-body">
Are you Sure!!! You want to delete this Ad?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info" id="btnContinueDelete">Continue</button>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
</div>
</div>
</div>
</div>
我的问题是,模式窗口的“继续”按钮从未将用户重定向到特定的控制器操作(MVC ASP.NET)您能帮我试试吗
$(document).on("click","#btnContinueDelete",function () {
window.location.href = '@Url.Action(actionName: "TipoEvento", controllerName: "Home")';
});
因为它是动态添加的。点击功能是否被点击?也许在单击功能中添加一个警报,看看它是否触发。它命中了,并且它似乎也重定向到了哪里-这就是问题所在我刚刚在继续按钮的单击事件中添加了一个警报窗口,但没有任何显示此模式是否是自动添加的?或者在呈现页面时它在dom上?@PabloMayora-尝试将Jquery更改为$(文档)。在('click','#btnContinueDelete',函数(){。我自己也很新,但遇到了click events.thakns的绑定问题,如果不是自动添加,它应该是热的吗
$(document).on("click","#btnContinueDelete",function () {
window.location.href = '@Url.Action(actionName: "TipoEvento", controllerName: "Home")';
});